Tuesday, March 26, 2013

How can you put uncommitted changes to a branch TEST when I am at the branch master

Every once in a while, I start changing code before switching to a new branch... then.... nuts!

I need to move these uncommitted changes to a new branch, or ... throw them away and start again.

Two Options:
1) You can just checkout to the new branch and then commit. You don't lose your uncommitted changes when moving to another branch.

git checkout -b new-branch-name
git add . 

2) Use Git Stash as a copy & paste:
git stash
git checkout other-branch-name
git stash apply

Thanks to Here

No comments: