Aiur – ZelluX 的技术博客

Security, Kernel, Virtualization, Programming Languages

在git中修改之前提交的内容

34 views | without comments

其实这个问题我以前在Stackoverflow上回答过别人http://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit,不过现在自己反而忘了,还是贴在这下次查起来方便点

先用git rebase bbc643cd^ –interactive 退回到要修改的commit的前一个点,这里bbc643cd就是要修改的commit,执行后git会调用默认的编辑器显示该次commit到最新commit的所有记录,在这里我们把要修改的那一项的行首的pick改成edit。

接下来运行git commit –amend,使用默认编辑器修改这次commit。

最后执行git rebase –continue就能提交修改后的commit并且返回到原来的commit了。

Related Posts

Written by zellux

November 10th, 2009 at 3:50 pm

Posted in Tools

Tagged with

Leave a Reply

FireStats icon Powered by FireStatsBetter Tag Cloud