如题,中间有一个错误的commit,然后后面又有一堆正确的,现在想删除这个错误,并保留正确的,如何操作?
淡淡烟草味2017-05-02 09:34:27
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)
黄舟2017-05-02 09:34:27
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
天蓬老师2017-05-02 09:34:27
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.