Saving the local changes temporarily in Git

Saving the local changes temporarily in Git

Imagine that you’re working on a big feature in your app. Then you get a critical bug ticket that should be resolved immediately. You don’t want to commit the messy code. You just want to save your dirty working environment, do urgent things, and go back to it. For this, you can use the command git stash.

$ git stash
Saved working directory and index state WIP on master:
fe100c4 Add modified one

Now your files are saved on the git-clipboard and you can work on your urgent bug.

After your urgent bug is solved, you may get your files from the clipboard using the command below.

git stash pop

The pop will also do a clean-up on the Stash.