git undo a particular commit

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed.
Objective: second submission lianx want to delete the contents, the beginning is trying to rebase method.
Initially git log at:
Here Insert Picture Description
git rebase -i commit_id (the above mentioned id before the second command): If you want to undo the second record, use the command
Here Insert Picture Description
to save and then after the second lianx vim editor's pick is changed to drop will
Here Insert Picture Description
then found after the submission of the second and the second time are gone, and git reset --hard commit_id like, did not solve the problem found
Here Insert Picture Description
then revert methods:

revert method:

History git log can view the documents submitted, such as:
Here Insert Picture Description
if I want to withdraw the second lianx, execute: git revert commit_id
Here Insert Picture Description
then error: could not revert 1abeebf ..., then the need to resolve the conflict: Here is the content of the submission of the second removed.
You can manually resolve conflicts in a file, or you can perform:
Here Insert Picture Description
and then do:
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
and then add, commit, push on it.
Note here: the revocation of commit_id this record is still there.

Guess you like

Origin blog.csdn.net/sinat_41747081/article/details/91384112