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

How to use the Git- command

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains the "use of Git- command", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the use of Git- command" bar!

Discard history

If the existing submission history: a-> B-> C-> D-> E-> F, and if you want to discard the previous submission history of C to make the history change to: C-> D-> E-> F, then:

Create a root submission based on C #, you can use git commit-tree

Change the base of Drecoe Epene F to the root submission that you just created. It is as follows:

$git log-- oneline-- decorate-- graph # current submission history * fdc7fff (HEAD, tag: F, master) F* d46f42d (tag: e) E* 6501e33 (tag: d) D* a0699ec (tag: C) C* b97d344 (tag: B) B* 7929c37 (tag: a) A $git commit-tree-m'C 'tags/ C ^ {} ^ {tree} # create a root submission 7b99fe372d8324172f88b814ff1bdffac97338b8 $git rebase-onto 7b99fe372d8324 C F # to perform a change base operation. First, reset the header pointer to replay your work on it. Positive application: d positive application: e positive application: F $git status # Note that the git rebase is in the state of detaching header pointer. # HEAD detached from 7b99fe3nothing to commit, working directory clean$ git checkout master # switch to master. Warning: you are leaving 4 submissions and are not associated with any branch: 4eb1223 F c5d1c66 E 9686a0e D 7b99fe3 C switches to branch 'master'$ git reset-- hard HEAD@ {1} # Note this step. $git status # is located on branch masternothing to commit, working directory clean$ git log-- oneline-- decorate-- graph # successfully deleted history * 4eb1223 (HEAD, master) F* c5d1c66 E* 9686a0e D* 7b99fe3 C Thank you for your reading The above is the content of "the use of Git- command". After the study of this article, I believe you have a deeper understanding of the use of Git- command, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report