Creating & Switching Branches
Creating a branch takes milliseconds — it is just a 41-byte pointer file. Switching updates your entire working directory to reflect that branch's state. Git performs both operations with incredible speed regardless of project size.
01.Branch Naming Conventions
Use lowercase hyphenated names with descriptive prefixes: feature/ for new features (feature/user-auth), fix/ or bugfix/ for bug fixes (fix/login-crash), hotfix/ for urgent production fixes (hotfix/xss-patch), release/ for release prep (release/v2.0), chore/ for maintenance (chore/update-deps). Always be descriptive — "my-branch" tells teammates nothing.
02.checkout vs switch
git checkout <branch> is the classic command — it does many things (switch branches, restore files). git switch <branch> is the modern alternative added in Git 2.23 specifically for switching branches. Both work identically for this purpose. git checkout -b and git switch -c both create AND switch in one step.
Commands
What does git checkout -b feature/x do?