1.3) GitHub Branches
A branch in Git and GitHub is a lightweight pointer to one of your commits. It allows you to work on different versions of a project at the same time, without affecting the main project or other branches.
Branching enables collaborative workflows, feature development, bug fixing, and experimentations, all in isolation from each other.
Here's a breakdown of what GitHub branches are and how they work:
The Default Branch: main
Branches allow you to isolate your work. For example, you might create a new branch to develop a feature, fix a bug, or test out an idea. You can create a branch for each of these tasks.
In GitHub Desktop: You can easily create a new branch by selecting Branch > New Branch from the top menu.
In Git CLI: Run git branch to create a new branch.
Once you switch to a branch, any changes you make (like adding files, editing code, or fixing bugs) will only apply to that branch. The main branch remains unaffected until you explicitly merge the branch back into it.
Your changes stay isolated from the default main branch until you are ready to combine them.```
https://i.imgur.com/TUgsQZD.png
Merging Branches