git stash changes and apply to new branch

Save cur­rent changes to the stash

git stash

Check­out the branch where you want to apply the changes

git checkout -b <branch_name>

See the files which are mod­i­fied in the stash.

git stash show

Print the stashed changes.

git stash show -p

Bring stashed changes to staged in the cur­rent branch.

git stash pop

To ver­ify the changes are stagged to the cur­rent branch

git status

Enjoy !!!

You may also like...