如何将旧提交更改为修复提交

时间:2016-10-12 16:53:13

标签: git

我有提交列表:

1a First commit
2b Second commit 
3c Third commit
4d fixup! First Commit
5e fixup! Second Commit
6f fixup! Third Commit
HEAD 6f

我希望能够在过去更改提交以成为修正,在某些情况下我想重定向所有修正!指向那个提交指向新修正!提交

说。

1a First commit
2b Second commit 
3c fixup! First Commit
4d fixup! First Commit
5e fixup! Second Commit
6f fixup! First Commit

1 个答案:

答案 0 :(得分:2)

  • 如果您希望将这些提交标记为fixup!

    使用git rebase -i并将pick 3c Third commit更改为reword 3c Third commit。如果您的配置中启用了fixup!,则还需要恢复标有autosquash的提交的顺序和操作。

  • 如果您不想将3c转换为fixup!,但您还希望将修补程序应用于相应的提交:

    使用git rebase -i --autosquash并将pick 3c Third commit更改为fixup 3c Third commit,并在pick 1a First commit后向右移动。其他提交已经重新排序。

相关问题