When using Git, the version is often rolled back if the error is push.
There are two ways to roll back a git: revert command
git revert version ID:
This command can be used to roll back the changes made to the specified version with a reverse commit. Then you can update the code on the Git push line.
When you use Git revert, you encounter a problem. For the code submitted by the merge, the following error occurs:
Commit XXX is a merge but no-m option was given.
For the merge score, if you want to revert, you need to make a rollback to which version, because the merge design to two versions:
Such as:
Merge branch ' Rms-develop ' into master
To roll back this situation, you can use the
git revert version id-m 1
This 1 refers to the master,2 refers to the develop. It is now part of the code that rolls back the develop merge to master on the master branch.
In this way, it is resubmitted once with a reverse push. You can see the action record in Git. two reset
This command is a reset, and the error is submitted. I want to delete this commit record. Rollback can also be implemented. Comparison of two commands:
Seemingly achieve the same effect, in fact, completely different.
First:
What we said above. If you have already push to the online code base, reset deletes the specified commit, and your git push can cause a lot of conflicts. But revert doesn't.
Second:
If the existing branch and historical branches need to be merged at a later time, the code for the Reset recovery section will still appear in the history branch. However, the commit committed by the revert direction does not appear in the history branch.
Third:
Reset is in the normal commit history, the deletion of the specified commit, when the head is moved backwards, and revert is in the normal commit history to commit again, but is a reverse submission, his HEAD is always forward.