How to create and switch branches in Git
Run git switch -c <name> to create a branch and switch to it in one step. Use git switch <name> to move between branches and git branch to list them.
Step by step
Create a branch and switch to it:
$ git switch -c dark-modeList your branches (* is the current one):
$ git branchSwitch back:
$ git switch mainOlder equivalent:
$ git checkout -b dark-mode
A branch is just a label pointing at a commit. HEAD tells you which branch you're on; new commits move that branch forward.