Quick Access
Introduction
Branches in Git are incredibly lightweight as well. They are simply pointers to a specific commit -- nothing more. This is why many Git enthusiasts chant the mantra:
branch early, and branch often
Because there is no storage / memory overhead with making many branches, it's easier to logically divide up your work than have big beefy branches.
When we start mixing branches and commits, we will see how these two features combine. For now though, just remember that a branch essentially says "I want to include the work of this commit and all parent commits."
Branching
Let's see what branches look like in practice.
Here we create a new branch named newImage with
git branch newImage
There, that's all there is to branching! The branch newImage now refers to commit C1.
Let's tell git we want to checkout the branch with
git checkout newImage
This will put us on the new branch before committing our changes.
git commit
There we go! Our changes were recorded on the new branch.
Ok! You are all ready to get branching.