其实拉Git [英] Actually pulling with git
问题描述
我在GitHub中有一个git repo。我一直主要使用 有没有这样的命令? 列出本地分行: 列出可用的远程分支: 现在变得有趣了,跟踪远程分支1: 这使得拉也可以在本地更新分支。 只需切换到新分支: 通过使用--track参数,远程分支被添加到.git / config并且将变得执着。即这只需要做一次。 .git / config中的相关条目将如下所示: 通过为每个远程分支运行分支--track命令,您希望在本地执行您想要的操作。 I have a git repo in GitHub. I've been mostly using Is there a command that does this? To list the local branches: To list available remote branches: Now it gets interesting, To track a remote branch1: This enables a pull to also update the branch locally. Simply switch to the new branch with: By using the --track parameter, the remote branches are added to .git/config and will become persistent. ie this only needs to be done once. The pertinent entries from .git/config will show like this: By running branch --track commands for each of the remote branches you would like to have locally will do exactly what you want. 这篇关于其实拉Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! git gui
来管理它,但现在我开始使用shell了。我想知道的是,我如何获取远程中的所有分支并自动将它们合并到本地回购库中的相应分支中?例如,如果我有分支 master
和 development
,并且因此 origin / master
和
origin / development
,我想获取 origin / master
并将它合并到 master
并获取 origin / development
并将其合并到 development
中。 / p>
$ git分行
*主行行
$ git branch -r
* master
branch1
branch2
$ git branch --track branch1
$ git checkout branch1
branch.master.remote =原始
分支。 master.merge = refs / heads / master
branch.branch1.remote = origin
branch.branch1.merge = refs / heads / branch1
git gui
to manage it up to now, but now I'm starting to use the shell. What I want to know is, how do I fetch all the branches in a remote and merge them into the respective branches on my local repo automatically? For example, if I have branches master
and development
, and thus origin/master
and origin/development
, I want to fetch origin/master
and merge it into master
and to fetch origin/development
and merge it into development
.$ git branch
* master
$ git branch -r
* master
branch1
branch2
$ git branch --track branch1
$ git checkout branch1
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.branch1.remote=origin
branch.branch1.merge=refs/heads/branch1