Situational guide to Git for new engineers - stashing changes

Situation: You have some ongoing work but not ready to commit.

Stash local changes command:

git stash

What does command do

This command purely puts away your current changes into what is called a Stash. It’s a little hidden place that is not a commit which puts your ongoing work on ice.

You might want to use this when you want to switch tasks and want to come back to current work later. This avoid having your incomplete work show up in commit history.

Return stash to current working branch command:

git stash apply

What does command do

You can have multiple stashes but this command returns the most recent one or top most stash back to your working directory. Keep in mind the stash will still be there. There is an option to apply and delete stash as well with git stash pop .