Branches are Git's way of creating parallel universes of your project. You can have multiple branches at once and switch between them instantly. Think of it like having a main storyline with different side questsβyou can explore each without disturbing the main plot.
Working with Branches
Start by listing all branches with `git branch`. Use `git branch new-branch` to create, then `git checkout new-branch` to switch. You can also combine them with `git checkout -b new-branch` to create and switch in one step. Each branch has its own set of commits that are independent.
$ git branch
$ git branch feature-login
$ git checkout feature-login
$ git checkout -b hotfix
$ git branch
Try it Yourself β