我有以下提交历史记录:
* 8cd26ba 2013-06-26 | history server-side (HEAD, noXHR)
* bffd858 2013-06-25 | popups and modals
* d95c5f4 2013-06-21 | Map update for new interaction
...
当我已经提交了'8cd26ba'时,发现模态机制存在一个bug并希望进行修复。我尝试修改'bffd858'(因为修复与此有关),如这里所述。我执行了以下步骤:
typed
$ git rebase -i bffd858
git shows me (in nano)
pick 6fa566b history server-side # Rebase bffd858..6fa566b onto bffd858 # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. #
I've replaced 'pick' with 'edit'
git said me:
Stopped at 8cd26ba... history server-side You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue
I've apply my bug-fix and typed
$ git commit -a --amend
typed
git rebase --continue
And then I've found my bug-fix in '8cd26ba' (last commit)!