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.
References
Subscribe to my newsletter
Read articles from Erdal TAŞKESEN directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Erdal TAŞKESEN
Erdal TAŞKESEN
Hey, y’all 🖖🏽 I am a passionate self-taught developer, open-source advocate, and tech enthusiast with a hands-on approach to problem-solving and an unending thirst for knowledge. Anything and everything classified as technology fascinate me.