现在我想从github中pull其develop分支,想达到本地也有master和develop分支的效果,但是我用
git pull origin develop
发现这条命令的结果是在本地的master分支基础上对github的develop分支进行合并
问题1:难道需要现在本地创建一个develop分支,然后checkout到本地develop分支,然后再执行git pull操作吗?如果是这样,那么如果本地分支的个数和github上相差很大时,需要每个都按照上面的方法走一遍?
问题2:有没有一条命令,能对本地的所有分支进行更新同步到github上面的版本?
问题3:有没有方法,能把所有的github的分支更新pull下来?
问题4:如果是本地存在某个分支test,而github上面不存在该分支,是不是需要人工删除?有没有像问题3中把所有分支更新pull下来,包括已删除的分支pull到本地之后,本地的相应分支也会删除
git fetch origin
取远程的变更即可。或者git pull
取当前分支的更新的同时会把其它分支也拖回来的。除非 clone 的时候用了-b
选项。你也可以用git fetch origin develop
来指定。git fetch
是git push
.man git-push
You can see the answer (well, even though I didn’t know it before):git pull
就是分为git fetch
和git merge
It is implemented by two commands, the former operates the repository, and the latter affects local files through the repository. Well, you canUnderstand git pull = fetch + merge, then question 3 cannot be done, because merge may have conflicts and can only operate one branch.
I also hate English manuals, they are hard to read. . .