How to Use Git Stash Command to Temporarily Save Your Changes

Okay, so picture this scenario. You are currently working on a piece of code that should bring a new feature to the application. All of a sudden, you urgently have to assist one of your co-workers with a bug that they found in a completely different branch. The first thing that you would want to do is to check which files you recently modified in the branch on which you are currently working. You can do that with a simple command. This command will show you modified files. Below, you can find an example of the output. Of course that you don’t want to lose your work on these files, but on the other hand you can’t just commit them. And that is where git stash shines! The command itself is extremely easy and straightforward. An example is below. The output will look similar to the one below. And that’s it! All your work on the current branch is saved in some sort of clipboard. Feel free to start working on whatever popped up in the meantime. Speaking of pop, here’s how you can return to the place where you left off once you are ready to continue. Simply type this into your terminal. After the command above, you will be returned to your last saved state.


You’ll agree with us when we say that this is a very simple Git command to learn and it is of real value to having knowledge of it. We certainly hope that you’ll find a good use for what you learned today. Remember, developing is a never-ending course when it comes to learning.