问题:
My colleague and I are working on the same repository we've branched it into two branches each technically for different projects, but they have similarities so we'll sometimes want to commit back to the * master
from the branch
. 我和我的同事正在使用同一个存储库,我们已经将其分为两个分支,每个分支在技术上均针对不同的项目,但是它们具有相似性,因此有时我们需要从该branch
提交给* master
。
However, I have the branch
. 但是,我有branch
。 My question is, how can my colleague pull that branch specifically? 我的问题是, 我的同事该如何专门拉那个分支?
A git clone
of the repo does not seem to create the branches locally for him, though I can see them live on unfuddle after a push on my end. 回购的git clone
似乎并没有为他本地创建分支,尽管我可以看到它们在结束我的努力后仍然活着。
Also, when I originally made the branch I did -b checkout
. 另外,当我最初创建分支时,我做了-b checkout
。 Not sure if that makes much difference? 不知道这有什么不同吗?
$ git branch -r
origin/HEAD -> origin/master
origin/daves_branch
origin/discover
origin/master
$ git fetch origin discover
$ git checkout discover
These are the commands I ran. 这些是我运行的命令。 But it definitely is not working. 但这绝对是行不通的。
I want to be able to check out that branch and then push and commit back just the branches changes from various collaborators or workstations . 我希望能够检出该分支,然后将各种协作者或工作站的分支更改推回并提交 。
解决方案:
参考一: https://stackoom.com/question/e16u/Git获取远程分支
参考二: https://oldbug.net/q/e16u/Git-fetch-remote-branch