"

Git branch switch

For that moment when you realise you’ve made changes you want to keep, but they should have been in a branch
Author
Affiliation

Building Stories with Data

Published

March 16, 2022

Set up a new file and then realised you’re in main rather than in the branch you should be in?

$ git switch the-branch-you-should-be-in

Keeps the local file so it’s ready to add and commit in the new branch instead of wherever you shouldn’t have been. Tada!

Reuse

Citation

For attribution, please cite this work as:
Thompson, Cara. 2022. “Git Branch Switch.” March 16, 2022. https://www.cararthompson.com/posts/2022-03-16-set-up-a-new-file/.