Separate switching branches from restoring files.
git switch changes branches. -c creates a branch and switches to it. Git 2.23 introduced switch and restore; older versions may need checkout.
git switch main
git switch -c feature/menuCheckout can switch branches or restore paths. That overload makes beginner mistakes easier. The double dash separates paths from revisions in path-checkout commands.
git checkout main
git checkout -b feature/menuA file operation is not a branch operation. Restoring a working file can overwrite uncommitted edits. Inspect status and diff before doing it.
git status
git diff -- notes.txt
# Only if you intend to discard those working-file edits:
git restore notes.txtSwitch --detach COMMIT_SHA deliberately checks out a commit without a normal branch. Before making new work there, create a branch so your commits have a durable name.
Which command creates and switches to a branch?
Choose an answer.
Command blocks are syntax examples checked against official documentation, not fabricated terminal output. Replace uppercase placeholders with your actual names and inspect status before commands that change work.