Original link: http://youngxhui.top/2022/09/gitrevert%E5%9B%9E%E6%BB%9A/
When submitting code recently, I found that it was necessary to roll back, but not just one version, but the previous merge. But after the merge, someone else made a code submission, which needs to be rolled back but cannot roll back a colleague’s code.
command meaning
When an error occurs, some errors can be rolled back through revert.
Revert the changes of a commit by revert without affecting the changes after the commit.
For example, the current version is
ABCDE
At this moment, it is found that there is an error in the C
submission. If you want to give up C
but do not want to break the two versions of DE
, you can use revert.
revert removes the C
version and generates a new version F
|
|
This command undoes the third commit from the current one. HEAD
means the first commit.
This version will generate a new F
ABCDEF
The D
and E
submitted at this time have not changed. It’s just that C
‘s submissions are all revoked.
Of course after revocation, conflicts may need to be handled manually.
This is just a basic revert operation.
This article is reproduced from: http://youngxhui.top/2022/09/gitrevert%E5%9B%9E%E6%BB%9A/
This site is for inclusion only, and the copyright belongs to the original author.