GIT如何删除一个中间的错误commit并保留后面正确的commit
phpcn_u1582
phpcn_u1582 2017-05-02 09:32:27
0
5
738

如题,中间有一个错误的commit,然后后面又有一堆正确的,现在想删除这个错误,并保留正确的,如何操作?

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