DEV Community

Heru Hartanto
Heru Hartanto

Posted on

How to Temporarily Store Changes in Git

git stash is a Git command used to temporarily save changes in your working directory without committing them.

This is useful when you want to switch branches or work on something else but don’t want to commit incomplete work.

Here some key command for git stash

git stash save

Saves your changes and resets your working directory to match the latest commit.

git stash save "WIP: working on feature"
Enter fullscreen mode Exit fullscreen mode

git stash list

To show all stash that you have made.

git stash list
stash@{0}: WIP: working on feature
Enter fullscreen mode Exit fullscreen mode

git stash drop

Removes a specific stash entry from the stack. You can drop the latest stash or specify one by index.

git stash drop stash@{0}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)