

This will bring up a list that looks something like this: git stash WIP on my-branch: ca96af0 Commit message WIP on my-branch: 03af20c Commit message WIP on my-branch: 216b662 Commit message 1īy default, stash entries are named WIP (Work in Progress), followed by the branch and commit the stash entry was created from.

To list all the stash entries, use git stash list. But it’s possible to store multiple stashes at the same time, and to apply them individually. Git stash apply will apply the last stash entry you created to your current working branch. To apply a stash entry including untracked files: git apply -u gitignore), we can add the -u (or -include-untracked) flag to our command:Ĭreate a stash entry including untracked files: git stash -u files that have not previously been staged, or files that are in our. If we want to create or apply a stash entry including untracked files (e.g. Stashing untracked filesīy default, git stash will only stash the tracked files. We can apply the stash entry to a different branch – it doesn’t have to be the branch that we created the stash from. To reapply our stashed changes at a later point, we can use git stash apply.Īpply a stash entry to your current working branch: git stash apply In its simplest form, the git stash command creates a stash entry. Stashing allows us to save a copy of our uncommitted changes on the current working branch. This is where Git’s stash command comes in useful. Or sometimes you might be working on a feature and you’re not ready to commit your changes yet, when someone asks you to fix an urgent bug and you need to jump onto another branch. When juggling multiple branches in Git, it’s easy to accidentally start working on the wrong branch, before realising you need to switch to another.
