当前多个commit,想把这几个commit合并成一个,但是想把其中某个commit add2的去掉,

git revert和rebase

用git revert add2的commit_id,这里只是撤销那次代码提交,后面的add3的代码提交依然存在且commit记录是依然保存的,且会生成一个新的commit

git revert和rebase

如果想把commit 记录清除掉

使用git rebase commit_id -i 这个时候会进入vim模式(这个地方区间是左开右闭的)

git revert和rebase

把后面三个改成s,第一个是pick就可以了

相关文章:

  • 2021-10-11
  • 2022-03-03
  • 2021-04-18
  • 2021-07-26
  • 2021-11-27
  • 2021-06-02
  • 2021-11-08
  • 2021-06-06
猜你喜欢
  • 2021-04-10
  • 2022-12-23
  • 2021-07-29
  • 2022-01-09
  • 2021-11-21
  • 2021-05-16
  • 2022-12-23
相关资源
相似解决方案