Example Analysis of Git revoking commit and add and forced fallback
Today, I will talk to you about the example analysis of Git revoking commit and add and forced fallback, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
1. Cancel after commit, do not undo add, and do not delete the changed code.
Git reset-- soft head ^
2. Undo add, or undo add after execution of 1
Git reset HEAD
3. Undo add and commit, and delete the change code
Git reset-- hard head ^
4. Undo push after remote (there is a way to reverse modify the record)
Operate revert on gitlab, or git revert-n version number
In this way, the revision of the version number is reversed to generate one more submission record.
5. Cancel the push to the remote branch (delete the submission method, provided that the branch cancels the branch protection)
First use git log to see the version number to be returned.
Git reset-- soft version number is being operated locally
Finally, execute the git push origin version number-- force
After reading the above, do you have any further understanding of the example analysis of Git undoing commit and add and forced fallback? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.