【发布时间】:2013-06-24 16:44:07
【问题描述】:
我的提交历史如下:
* 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”时,我发现了模态机制中的一个错误并想要修复它。我试图修改'bffd858'(因为修复与它有关),因为它described here。我做了以下步骤:
-
输入
$ git rebase -i bffd858 -
git 向我展示(在 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. # 我已将“pick”替换为“edit”
-
git 说我:
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 -
我已经应用了我的错误修复并输入了
$ git commit -a --amend -
打字
git rebase --continue 然后我在“8cd26ba”中找到了我的错误修复(last 提交)!
我做错了什么?
【问题讨论】:
-
感谢 Sylvain Defresne 的建议!真正让我感到困惑的是,原来的问答“~1”部分被遗漏了。魔鬼在细节!
标签: git