Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Git revoking commit and add and forced fallback

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report