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.

Advertisements

One thought on “Git — Change Branch for Uncommitted Working Copy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s