In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to achieve "git stash" temporary storage operation, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Why do we need it?
I have to say, I love this command when I know it and use it later, because it is so easy to use.
Tell you a little bit about the scene where I used this command:
At this time, I am in the feature_666 branch, very focused on the implementation of a functional 666 module, such as the keyboard to write code ~ ~
Then at this time, the customer feedback a bug, very serious, must be resolved immediately, priority is 0!
So, I need to go to the release branch to work on the new checkout branch, but what if the 666 function is not finished yet?
At this point, I was faced with a multiple choice question:
A: switch after submission, and the code is saved to the branch feature_666, resulting in a meaningless submission
B: switch directly without submitting, but no one will choose this option at all.
Is it difficult to choose? at this time, don't forget that there is a C option!
C: using git stash, store the current modification (uncommitted code) in the cache, switch branches to modify the bug, and then retrieve it through git stash pop.
1. Temporary operation
# View the current status git status # if there is any modification, add the modification file git add. # temporary storage operation git stash save 'identification name of this temporary storage'
two。 View the current temporary record
# View record git stash list
Where is the modification and storage location?
When we use git init to add version control to a project, a .git hidden folder is generated under the project path. All versioning information is stored in .git.
In .git / refs/stash, the node pointer corresponding to the last stash is stored.
Similarly, you can see all our stash record information in .git / log/refs/stash
The case of storing multiple stash
Ok, let's try to modify the file, and then use git stash again, at this time we have two temporary changes, so how to check it?
Git stash list / / View all temporary changes in the staging area
If you execute git stash twice without submission, you will not be able to tell exactly what the two stash are modifying. In this way, the great Git is not smart at all, how can you!
So, in this case, it is obviously important to give a name to the modification of the stash storage, as follows:
Git stash save
3. Resume temporary work
'The pop command restores. After the restore, the temporary area deletes the current record'
# resume specified temporary storage work. The temporary storage record is saved in list. You need to retrieve git stash pop stash@ {index} through list index index retrieval.
'The apply command restores. After the restore, the temporary storage area retains the current record'
# resume specified temporary storage work. The temporary storage record is saved in list. You need to retrieve git stash apply stash@ {index} through list index index retrieval.
4. Delete temporary storage
# Delete a temporary storage, and the temporary record is saved in list. You need to retrieve git stash drop stash@ {index} # delete all temporary git stash clear through the list index index. The above is all the contents of the article "how to achieve" git stash "temporary storage operation". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.