Scott Whittaker

Frontend Developer

Day job React | side projects Svelte

git - create new branch

Everything has fallen out of my mind including git basics, I need to write this down.

$ git branch my-new-branch
$ git checkout my-new-branch

Or shorthand…

To create a new branch and switch to it at the same time, you can run the git checkout command with the -b switch.

Git Branching - Basic Branching and Merging
$ git checkout -b my-new-branch
Switched to a new branch "my-new-branch"