Branches allow you to work on different versions of a project simultaneously. This is useful for new features or bug fixes.
Task 3: Create a new branch and switch to it.
git checkout -b feature-branch
This creates and switches to a new branch called feature-branch.
Task 4: Merge a branch into the main branch.
git checkout main
git merge feature-branch
This merges the feature-branch into the main branch.