Background:
In git collaboration, members inevitably commit some wrong versions, and because Git introduces a local repository compared to SVN, the operation is relatively complex, with the following posture decomposition
Find a source file Rsputils.java, plus a line of comments//test fallback git server version, then commit and push, now the version record is as follows (Mac version of Sourcetree for example)
dd5f51f ... Is the problematic version, now we have to fall back to 7a22c8f ... version, check 7a22c8f ... version, right click, pop-up option
Select, reset Master to this commit, and this is the Reset command.
Select Hard mode and then right-click on the latest version record on the current trunk to continue selecting Reset Master to this commit
Select soft Mode
Commit + Push completes the version fallback on the server, and the final version record is as follows:
No message is my last commit version, because no comment, the tool automatically added (the actual work does not write comments or comments written not understand is very bad habit, must be determined to correct)
Note: From the 1th diagram and the last figure can be seen, in the 1th figure, I have not submitted records uncommited changes, after reset hard lost, so everyone in the fallback version must keep a clear mind, use reset hard
Overview of the whole posture (principle):
Reset-hard XXX Discard Local modification fetch server overwrite off local
Rest-soft XXX Points The local pointer to the latest version of the trunk
Commit
Push
Git fallback to a version of the server correct posture