TOPIC GIT
Branching & Merging parallel work, one history
IN 10 SECONDS
A branch is just a pointer to a commit hash. Merging integrates commits from a feature branch into the target branch, either via fast-forward or a merge commit.
GOTCHA Fast-forward merges copy commits directly without creating a merge commit, losing the context that they were developed on a feature branch.
HOW BRANCH INTEGRATION FLOWS
01 Branch create creates pointer tag: git checkout -b feature-a from main.
02 Feature edits makes commits on feature-a, moving feature-a pointer forward.
03 Merge call checks out main, calls git merge feature-a.
04 Merge Commit git creates a new commit containing two parent hashes (main and feature-a).
POKE IT YOURSELF
git merge --no-ff feature-branch — force git to create a merge commit even if fast-forward is possible
Drill this topic →
~65 sec read