Jighead
7/18/2018 - 1:55 PM

Stash Changes, Create New Branch, Put changes on New Branch

Sometimes you forget to create a new branch and start making changes to code. This is how you stash your changes, create a new branch and them move them to the new branch.

Save current changes to the stash
git stash


Checkout the branch where you want to apply the changes
git checkout -b <branch_name>


See the files which are modified in the stash.
git stash show


Print the stashed changes.
git stash show -p


Bring stashed changes to staged in the current branch.
git stash pop


To verify the changes are stagged to the current branch
git status