How does GIT delete an intermediate incorrect commit and keep the subsequent correct commits?
phpcn_u1582
phpcn_u1582 2017-05-02 09:32:27
0
5
766

As shown in the title, there is an incorrect commit in the middle, and then there are a bunch of correct commits. Now I want to delete this error and keep the correct ones. How to do it?

phpcn_u1582
phpcn_u1582

reply all(5)
淡淡烟草味

The normal approach is to rebase and process subsequent commits manually (resubmit all useful commits, ignore useless commits, and merge redundant commits). The risks and difficulties are relatively high. (Repair the situation, save the sheep and kill the wolf)

The lazy way is to go back to before the wrong commit, and then resubmit with a new branch. This is safe, but the workload will be relatively large, and it is easy to make mistakes in the middle. (Repair the sheep’s fold, mend the sheepfold and save the sheep)

It’s even more lazy to commit a new submission later to correct the previous error. (Repair the lost sheep, mend the sheepfold and buy a new sheep)

我想大声告诉你

git revert wrong_commit

黄舟

git rebase -i returns to a previous version containing the wrong submission. There is an option to abandon a certain submission. Please refer to Baidu for specific usage

世界只因有你

I don’t know if you are asking about commit --amend...

Peter_Zhu

It doesn’t seem to work, unless you RESET back to the previous submission, then delete the subsequent submission log, and then resubmit what you need. I checked before.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template