← Branching & Merging
Create a branch
Learn
Create a branch
git switch -c hotfix # create a branch called "hotfix" and switch to it
git branch # list branches; * marks the one you're on
git switch -c <name> is the modern way to create-and-switch (older guides use
git checkout -b). A new branch starts at the commit you're on, so at first it's
identical to main: it only diverges once you commit on it.
Type each command into the terminal and press Enter.
Your task
Create and switch to a branch called feature with git switch -c, then run git branch to list branches — feature should be marked current with *.