What is a Branch?
A branch in Git is a lightweight movable pointer to a commit. It lets you work on different versions of your project simultaneously.
List Branches
git branch
Shows all branches in the repository. The current branch is highlighted with an asterisk (*).
Create a New Branch
git branch new-branch-name
This creates a new branch but does not switch to it.
Switch Branch
git checkout new-branch-name
Switches to the specified branch.
Create and Switch Branch
git checkout -b new-branch-name
Creates a new branch and switches to it in one command.
Delete a Branch
git branch -d branch-name
Deletes the specified branch.