我知道如何轻松“修复”这种状态,当我在交互式rebase期间不小心执行了
我只是使用Mac OSX终端。如果解决方案需要,我也可以尝试其他终端程序。
git commit --amend
。但我想知道是否有任何解决方案,无论复杂程度如何,都可以让我配置git/终端/bash来防止我执行此操作。我只是使用Mac OSX终端。如果解决方案需要,我也可以尝试其他终端程序。
1 @: master$ git pull
2 @: master$ git checkout my/feature/branch
3 @: my/feature/branch$ git rebase -i master
// There are merge conflicts
// I fix them, then
4 @: my/feature/branch$ git add .
// Then what I should do is:
5correct @: my/feature/branch$ git rebase --continue
// But instead, just due to dumb muscle memory, I do:
5incorrect @: my/feature/branch$ git commit --amend
我可以轻易地修复破碎的结果状态。我只是试图找出是否有一种方法可以配置某些东西来防止我在重新基础时执行5次错误的命令。
git
之外的其他东西,当你输入git ...
时,在那个别名/函数/脚本中,检查你是否在一个变基中,以及你是否想允许一些其他的命令——但是在交互式变基期间进行修改和/或额外提交是正常的,以拆分提交。(提示:在bash中的一个技巧是,command foo
会运行实际的foo而不是你的别名,因此需要在需要时在你的别名中使用它。) - torek