Last Updated: February 25, 2016
·
1.151K
· pocha

git checkout <branch> moves uncommitted changes to the new branch

Recently I started creating temporary branches in my git repo to be able to move my temporary changes & not to corrupt my main branch.

I realized that unless I do not commit the temporary changes in the new branch, those changes come back to the main branch once I switch back to the main branch. This was not obvious to me. Sharing the pro-tip in case you are someone like me :).