Git — Change Branch for Uncommitted Working Copy

Say you’re working on branch x and you started to make some changes.

You suddenly realize you meant to be on branch master.

You can’t switch branches w/o committing.

Here’s how to switch:

git stash
git checkout master (or whatever branch you meant to be in)
got stash pop

Resolve the conflicts you get, and you’re good to go.

1 Comment

Leave a Comment