备录下,省的又忘了。


比如要修改之前的commit的 hashcode为:187f869c9d54c9297d6b0b1b4ff47d2ec781a55e


Step 1:
先用git rebase 187f869c9d54c9297d6b0b1b4ff47d2ec781a55e^ --interactive //退回到要修改的commit的前一个点上,
执行后,git会调用默认的vi编辑器显示commit到最新commit的所有记录,把我们要修改的那一项的首行的pick 改成edit。


Step 2: 修改完我们要修改的内容后,利用git add 添加
 git add <filepattern>


Step 3: git commit --amend //修改这个commit




Step 4: git rebase --continue // 提交修改后的commit 并且返回到原来的head 处。



Fixing git: “interactive rebase already started”


If you’re like me, a fan of rebasing local work before publishing, maybe you receive this error:


"interactive rebase already started"


This happens when you abort in the middle of a rebase.


The way to fix it is using:


git rebase -i --abort

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐