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.
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 checkout other-branch-name
git stash apply
Thanks to Here
Post a Comment