Git temporary workspace stash

Source: Internet
Author: User

Git version 1.9.6


Git name Stash: helps developers temporarily hold the changes they have made, move them back to the status before the changes, and perform other necessary operations (such as solving a bug ), changes that were put on hold after the bug was fixed and re-loaded.

You can think of running the stash action as temporarily saving the current commit status to a space (stack memory );

Example:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/A6/wKiom1RWMOTidoFCAAKXL5QjAM4700.jpg "Title =" c1.jpg "alt =" wkiom1rwmotidofcaakxl5qjam4700.jpg "/>

You can see that the stash action restores the status to before modification;

1. Main commands

Git stash # drop into the staging area git stash list # list all data in the staging area git stash pop # retrieve the status of the last temporary storage in the staging area (stack memory, advanced and later) next, follow the selected record @ {n} git stash apply # retrieve the last saved state in the temporary storage area, but the stash record does not remove git stash clear # Clear the stash record

Example: Modify the local code, add it to the staging area, save the modified Code to the stash, restore it to the unmodified one, modify the code, submit the code, and then retrieve the records in the temporary storage area, submit the modification again;

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

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4D/A6/wKiom1RWP2SxPxtFAAMf45J33ak502.jpg "style =" float: none; "Title =" c2.jpg "alt =" wkiom1rwp2sxpxtfaamf45j33ak502.jpg "/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4D/A5/wKioL1RWP8Kz9Lf4AANV4CnbKPY753.jpg "style =" float: none; "Title =" c3.jpg "alt =" wkiol1rwp8kz9lf4aanv4cnbkpy753.jpg "/>

The last conflict is displayed. No matter what it is, describe the stash function first, and keep the branch behind to solve the conflict problem.

This article is from the "Big Brother" blog, please be sure to keep this source http://lansgg.blog.51cto.com/5675165/1571266

Git temporary workspace stash

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.