Return to site

GIT STASH IN SHORT

=>How to Save Your Changes Temporarily

· github

DEFINE:

There are lots of situations where a clean working copy is recommended or even required: when merging branches, when pulling from a remote, or simply when checking out a different branch.
The "git stash" command can help you to (temporarily but safely) store your uncommitted local changes - and leave you with a clean working copy.

broken image

EXAMPLE:

―git stash: a clipboard for your changes

$ git status
modified: index.php
modified: css/styles.css

$ git stash
Saved working directory and index state WIP on master:
2dfe283 Implement the new login box
HEAD is now at 2dfe283 Implement the new login box

Your working copy is now clean: all uncommitted local changes have been saved on this kind of "clipboard" that Git's Stash represents. You're ready to start your new task (for example by pulling changes from remote or simply switching branches).

―git stash pop: continuing where you left off

$ git stash pop

The "pop" flag will reapply the last saved state and, at the same time, delete its representation on the Stash (in other words: it does the clean-up for you).