If you move around between different branches a lot in Git, you might find that you accidentally make some changes on the wrong branch and only realise this when it comes to stage/commit them. As always, Git has a solution.
Assuming you haven’t staged any changes (using git add), the following three commands will switch everything to a new branch:
git stash git checkout correct-branch git stash pop