TL; DR:是否可以从合并(无快进合并)分支重命名提交 - 而不破坏历史记录?
我想重命名提交。像rebase --interactive HEAD~5
这样的东西。但我想让HEAD保持现状。 Rebase将压平日志。
我正在使用功能分支
* c3cb3ad - Merge branch 'featureX' into develop (15 minutes ago) <FOO>
|\
| * d945c71 - Did stuff (17 minutes ago) <FOO>
| * d4356f4 - inline commits are aweosm <FOO> (27 minutes ago) <LSC>
|/
* 6ef9569 - bla bla bla
这就是我git的方式:
~/dev/foo/ (develop)$ git checkout -b featureX
~/dev/foo/ (featureX)$ git add foo.html
~/dev/foo/ (featureX)$ git commit -m "inline commits are aweosm"
~/dev/foo/ (featureX)$ git checkout develop
~/dev/foo/ (develop)$ git merge --no-ff featureX
~/dev/foo/ (develop)$ git branch -D featureX
~/dev/foo/ (develop)$ git add bar.html
~/dev/foo/ (develop)$ git commit -m "Lorem Ipsum"
......哦,废话。我的提交信息中有一个拼写错误!
答案 0 :(得分:4)
将git rebase
与--preserve-merges