可以“git pull --all”更新我所有的本地分行? [英] Can "git pull --all" update all my local branches?

查看:1243
本文介绍了可以“git pull --all”更新我所有的本地分行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常有至少3个远程分支:主人,舞台和制作。我有3个本地分支机构跟踪那些远程分支机构。



更新我所有的本地分行非常繁琐:

  git fetch --all 
git rebase origin / master
git checkout staging
git rebase origin / staging
git checkout production
git rebase origin / production

我希望能够做一个git pull -all ,但是我一直没有能够得到它的工作。它似乎做了一个fetch -all,然后更新(快进或合并)当前工作分支,但不是其他本地分支。

我是仍然卡住手动切换到每个本地分支并更新。

解决方案

所有完全符合预期,但不一定有用。该选项被传递给git fetch,然后从所有遥控器中获取所有的ref,而不是仅仅需要一个。 pull 然后合并(或者在你的情况下,rebases)适当的单个分支。



如果你想退房其他分支机构,你将不得不检查出来。是的,合并(和重新定义)完全需要一个工作树,所以他们不能检查出其他分支。如果你喜欢,你可以把你描述的步骤合并到一个脚本/别名中,不过我建议用&& 加入这些命令,这样如果其中一个失败了,它不会尝试耕耘。


I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.

Updating all my local branches is tedious:

git fetch --all
git rebase origin/master
git checkout staging
git rebase origin/staging
git checkout production
git rebase origin/production

I'd love to be able to just do a "git pull -all", but I haven't been able to get it to work. It seems to do a "fetch --all", then updates (fast forward or merges) the current working branch, but not the other local branches.

I'm still stuck manually switching to each local branch and updating.

解决方案

The behavior you describe for pull --all is exactly as expected, though not necessarily useful. The option is passed along to git fetch, which then fetches all refs from all remotes, instead of just the needed one; pull then merges (or in your case, rebases) the appropriate single branch.

If you want to check out other branches, you're going to have to check them out. And yes, merging (and rebasing) absolutely require a work tree, so they cannot be done without checking out the other branches. You could wrap up your described steps into a script/alias if you like, though I'd suggest joining the commands with && so that should one of them fail, it won't try to plow on.

这篇关于可以“git pull --all”更新我所有的本地分行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆