假设我已经在当地分公司工作了一个星期。现在我已准备好上传它以进行代码审查,但首先我要更新我的主分支,然后在其上重新定义我的本地分支。
因此,在更新我的主分支后,我运行:
git rebase master mybranch
嗯,哦!我遇到了大量的合并冲突。而不是变基,我想使用合并,或者可能使用rebase --onto,或类似的其他东西。
所以我跑:
git rebase --abort
现在问题出现了 - 在中止之后,它会检查出mybranch。
我不希望它这样做。有没有办法运行“git rebase --abort”但保留“master”签出?
可能的原因:
答案 0 :(得分:1)
中止后不检查mybranch;检查mybranch是它做的第一件事。来自git-rebase(1)
:
git rebase [-i | --interactive] [options] [--exec <cmd>] [--onto <newbase>]
[<upstream> [<branch>]]
...
If <branch> is specified, git rebase will perform an automatic git
checkout <branch> before doing anything else. Otherwise it remains on
the current branch.
此处mybranch
为<branch>
,因此无论您是中止还是继续使用rebase,它都已在开始时检出mybranch
。