About Git's stash command

Source: Internet
Author: User

Git stash can be used to stage the current work, such as to pull the latest code, do not want to add a new commit, or another situation, in order to fix an urgent bug, first stash, so that return to their previous commit, change the bug after the stash pop, Continue the original work.
Basic command:
$git Stash
$do some work
$git Stash Pop


Advanced:

git stash Save "work on progress forfoo feature"

When you use the ' git stash ' command multiple times , your stack will be filled with uncommitted code, and you'll be confused about which version to apply back,

'git stash list' command can print the current git stack information, you just need to find the corresponding version number, for example, using 'git stash apply [email protected]{1} ' You can specify the version number as [Email protected] The work of {1} is taken out and when you apply all the stacks back, you can use 'git stash clear' to empty the stack.


git stash          # Save uncommitted changes# Pull, edit, Etc.git stash list     # list stashed changes in this gitgit show [E Mail protected]{0} # See the last stash git stash pops      # Apply last stash and remove it from the Listgit stash--help
   # for more info

Git stash: Backs up the contents of the current workspace, reads the content from the most recent commit, and makes the workspace guarantee consistent with the last commit. At the same time, save the current workspace content to the git stack.

Git stash pop: reads the last saved content from the Git stack and restores the workspace. Because there may be multiple stash content, the pop reads the content from the most recent stash and recovers it by using a stack to manage it.

Git stash list: Displays all the backups in the GIT stack and can use this list to decide where to recover from.

Git stash clear: Empty the git stack. Using graphical tools such as GITG, you will find out which nodes of the original stash have disappeared.

About Git's stash command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.