In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "the use of git undo". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of git undo.
Undo local changes
[root@xuhx-02 git_project] # git status# changes that have not been temporarily stored in the branch master# for submission: # (use "git add..." Update the content to be submitted) # (use "git checkout--..." Discarding workspace changes) # # modifications: README.md# modifications have not yet been submitted (using "git add" and / or "git commit-a") [root@xuhx-02 git_project] # git checkout-- README.md [root@xuhx-02 git_project] # git status# is located in the branch master with no files to submit, clean workspace
Undo git add
[root@xuhx-02 git_project] # git add 01.sh [root@xuhx-02 git_project] # git status# changes to be submitted at branch master#: # (use "git reset HEAD..." Withdraw from the staging area) # # New file: 01.sh# [root@xuhx-02 git_project] # git reset HEAD 01.sh [root@xuhx-02 git_project] # git status # untracked file located in branch master#: # (use "git add." Empty to include content to be submitted) # # 01.sh submission, but there are files that have not yet been tracked (use "git add" to establish a trace)
Undo commit
[root@xuhx-02 git_project] # git commit-m "add 01.sh" [master 9d8cbe9] add 01.sh 1 file changed, 10 insertions (+) create mode 100644 01.sh
-- mixed: do not delete the workspace change code, undo commit, and undo git add. Operation
[root@xuhx-02 git_project] # git reset-- mixed head ^ [root @ xuhx-02 git_project] # git status# is located in the untracked file of the branch master#: # (using "git add." Empty to include content to be submitted) # # 01.sh submission, but there are files that have not yet been tracked (use "git add" to establish a trace)
-- soft: do not delete the workspace change code, undo commit, do not undo git add.
[root@xuhx-02 git_project] # git reset-- soft head ^ [root @ xuhx-02 git_project] # git status # changes to be submitted at branch master#: # (use "git reset HEAD..." Withdraw from the temporary storage area) # # New file: 01.sh#
-- hard: delete the workspace change code, undo commit, undo git add. Notice that after completing this operation, you are back to the previous commit state.
[root@xuhx-02 git_project] # git reset-- hard f51b0fdfa6846f88b90ac76e7975594bdd887576HEAD is now located at f51b0fd add README [root @ xuhx-02 git_project] # lsREADME.md
-- amend: the modified file has been git commit, but if you want to modify it again, it will not generate a new Commit.
# resubmit $git add sample.txt$ git commit-amend-m "description"
Clear Workspace git clean
[root@xuhx-02 git_project] # git clean-n will delete 01.sh
Refer to git undo rollback learning
At this point, I believe you have a deeper understanding of "the use of git undo". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.