ILD

git删除一个commit
作者:Herbert Yuan 邮箱:yuanjp89@163.com
发布时间:2019-3-2 站点:Inside Linux Development

想要从git中永久的删除一个commit,可以使用

1
$ git rebase -i HEAD~4

-i是交互模式,在弹出的编辑中,d删除对应的commit即可。


这是个vi编辑器,编辑后退出,git将执行rebase和gc

Successfully rebased and updated refs/heads/merge_linux.

Auto packing the repository in background for optimum performance.

See "git help gc" for manual housekeeping.


Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.