Tag Archives: git

Stashing changes with Git

Sometimes you’ve started some work on your project, then realised you should have started a new branch.
Create a new stash, using

git stash

See Git Stash for more details
This resets the Head back to your last commit, and stores the changes made since then in a new stash. List the stashes you have using

git stash list

Switch to the new branch then use

git stash apply

to apply the changes. If you have lots of stashes, you can use stash@{2} if you have more than one stash. Dont forget to

git stash drop

after you’ve copied the stash to the new branch.