Git Stashing Move your work in progress to another branch


If while working you realize you're on wrong branch and you haven't created any commits yet, you can easily move your work to correct branch using stashing:

git stash
git checkout correct-branch
git stash pop

Remember git stash pop will apply the last stash and delete it from the stash list. To keep the stash in the list and only apply to some branch you can use:

git stash apply