[英]Git fetch/rebase master branch when other branch is checked out
Currently when I'm working on my local feature branch in order to get latest changes I need to do the following: 当前,当我在本地功能分支上工作时,为了获取最新更改,我需要执行以下操作:
git checkout master
git fetch
git rebase
git checkout my-feature
git rebase master
Is there a simplier solution to just pull changes to master branch without switching to it? 是否有一个简单的解决方案,仅将更改拉到主分支而不切换到主分支?
I think Git will always switch to master
behind the scene, to perform the rebase (considering that rebase
starts by a checkout of the destination branch: 我认为Git总是会在后台切换到master
来执行rebase(考虑到rebase
是通过检查目标分支开始的:
see " git rebase
, keeping track of ' local
' and ' remote
' "). 参见“ git rebase
,跟踪' local
'和' remote
' ”。
You just can use the shortcut git pull --rebase
: 您只可以使用快捷方式git pull --rebase
:
git pull --rebase master:master
git checkout my-feature
git rebase master
I think you can just do a git fetch
followed by a git rebase origin/master
That should rebase your topic-branch against master. 我认为您可以先执行git fetch
然后再执行git rebase origin/master
这将使您的主题分支基于master进行基础调整。 Don't know if the fetch is really necessary though. 但是不知道获取是否确实必要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.