A branch is an independent line of development. The default branch is usually main.
git branch: list branches.
git switch -c feature-login: create a branch and switch to it.
git switch main: switch back.
git branch -d feature-login: delete a merged branch.
Commits made on a feature branch do not affect main until you merge them.
💡 Key Takeaways: Git Branches
Mastering Git Branches helps you write clean and reliable Git code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.