拉取所有 git 个存储库分支
pull all the git repository branches
如何拉取存储库的所有 git 分支。
我尝试了 this and this 个问题的几个答案,但似乎对我来说没有用。
有3个分支,但是当我做的时候
git branch
只显示master分支
git branch -a
给出这个输出
* master
origin/HEAD
origin/development
origin/feature1
origin/master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/feature1
remotes/origin/master
因此,我无法检出到 feature1 分支,因此无法检查位于 feature1
的代码
请帮忙
我在我的一个项目中使用了 git。
第 1 步:将所有分支作为源进行检出(即,在存储库级别)。
第 2 步:下次将存储库拉到其他站点时将带来所有这些分支。
您可以从拉取的存储库中通过 checkout 命令切换到任何分支。
希望这能解决您的问题。
阿莫尔
当您执行 git fetch
时,您实际上检索了远程存储库的所有分支(如果您有多个远程存储库,则可以执行 git fetch --all
)
如果 git branch -a
给你
* master
origin/HEAD
origin/development
origin/feature1
origin/master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/feature1
remotes/origin/master
并且您对feature1
感兴趣,那么您只需要做git checkout origin/feature1
。现在你甚至可以 git branch feature1
如果你想要一个本地分支。
如何拉取存储库的所有 git 分支。
我尝试了 this and this 个问题的几个答案,但似乎对我来说没有用。
有3个分支,但是当我做的时候
git branch
只显示master分支
git branch -a
给出这个输出
* master
origin/HEAD
origin/development
origin/feature1
origin/master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/feature1
remotes/origin/master
因此,我无法检出到 feature1 分支,因此无法检查位于 feature1
的代码请帮忙
我在我的一个项目中使用了 git。
第 1 步:将所有分支作为源进行检出(即,在存储库级别)。
第 2 步:下次将存储库拉到其他站点时将带来所有这些分支。
您可以从拉取的存储库中通过 checkout 命令切换到任何分支。
希望这能解决您的问题。 阿莫尔
当您执行 git fetch
时,您实际上检索了远程存储库的所有分支(如果您有多个远程存储库,则可以执行 git fetch --all
)
如果 git branch -a
给你
* master
origin/HEAD
origin/development
origin/feature1
origin/master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/feature1
remotes/origin/master
并且您对feature1
感兴趣,那么您只需要做git checkout origin/feature1
。现在你甚至可以 git branch feature1
如果你想要一个本地分支。