有没有办法运行git rebase --abort而不切换分支?

时间:2015-11-03 14:41:01

标签: git

假设我已经在当地分公司工作了一个星期。现在我已准备好上传它以进行代码审查,但首先我要更新我的主分支,然后在其上重新定义我的本地分支。

因此,在更新我的主分支后,我运行:

git rebase master mybranch

嗯,哦!我遇到了大量的合并冲突。而不是变基,我想使用合并,或者可能使用rebase --onto,或类似的其他东西。

所以我跑:

git rebase --abort

现在问题出现了 - 在中止之后,它会检查出mybranch。

我不希望它这样做。有没有办法运行“git rebase --abort”但保留“master”签出?

可能的原因:

  • 存储库有很多文件,检查它们的速度很慢。
  • 我刚从源代码编译“master”,需要一段时间才能编译。检查上周的代码意味着从头开始重新编译。

1 个答案:

答案 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