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

Git staging workspace stash

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

Share

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

Git version 1.9.6 of this article

Git name stash: helps developers to temporarily shelve the changes they have made, go back to the state before the changes, do other necessary actions (such as resolving a bug, etc.), and reload the changes that were shelved before the bug is resolved.

You can think of performing a stash action as temporarily saving the current commit state to a space (stack memory)

Example:

You can see that the stash action returns the state to the unmodified state.

1. Main command

Git stash # throw into the staging area git stash list # list all the data in the staging area git stash pop # remove the last staging state of the staging area (stack memory, first in, first out) followed by the selected record @ {n} git stash apply # fetching the last staging state of the storage area But the stash record does not remove git stash clear # empty the stash record

Example: modify the local code, add it to the staging area, save the modified code to stash, restore it to the unmodified, modify the code, and then submit it; then take out the record of the temporary storage area, and submit it again after the modification is completed

$cat hello.rb$ git status-s $echo "stash 1" > > hello.rb$ git status-s $git stash$ git stash list$ git stash pop

Finally, the conflict is displayed. Forget it, explain the function of stash first, and leave the later branches to solve the conflict problem.

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