编程知识 cdmana.com

How does git only modify the middle commit content? Keep the original order

background
Our company uses gerrit review Code , I have time to submit three at the same time commit, modify 1、 modify 2、 modify 3, And there's no perfect decoupling between them , Sometimes there's a back and forth dependency , Only the second failed review, At this time, I just want to modify it for the second time commit The content of , And affect others commit, How to do it? ?
image.png

Method
1、 Submit it again fix modify 2
2、git rebase -i HEAD~4 At this time, you can see the following :
image.png
Next change it to the following :
image.png
Save and exit , The following :
image.png
Change to this :
image.png
Save and exit , Be accomplished . You can see git log

版权声明
本文为[seven]所创,转载请带上原文链接,感谢

Scroll to Top