A branch in Git is a lightweight movable pointer to the commits that you make. The name of the default branch is master. Whenever you make any commit, it automatically moves forward.
In Git, you can create sub-branches to create another line of development from the master repository to work on a new feature or to fix a bug. Once the feature or the bug fixing is complete, it is merged back to the main/master branch and deletes the sub-branch that we worked with as shown in the following diagram:
Every branch is referenced by HEAD, which points to the latest commit in that branch. Whenever you make a commit, the HEAD ...