Branches are just pointers — understanding this makes branching instant and merge strategies clear
Branches are the core of parallel team work. Because a branch is just a 41-byte pointer to a commit, creating or deleting one is instantaneous — there's no reason to fear branching often. Understanding what kind of merge git performs, and why, determines how your project history looks and how easy reverting or bisecting will be later.
A branch is a file in .git/refs/heads/ containing one SHA. That's it. HEAD is another file — it points to the current branch name (or directly to a commit SHA in "detached HEAD" state). When you commit, git writes the new SHA into the current branch file.
Fast-forward merge: the target branch hasn't diverged — git just moves the pointer forward. Three-way merge: both branches have new commits — git finds the common ancestor, combines changes, and creates a merge commit with two parents.