GIT / A CONCEPT NOTE
Branching & Merging
parallel work, one history
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
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.
02 / FOLLOW THE MECHANISM
How branch integration flows
Branch create
creates pointer tag: git checkout -b feature-a from main.
Feature edits
makes commits on feature-a, moving feature-a pointer forward.
Merge call
checks out main, calls git merge feature-a.
Merge Commit
git creates a new commit containing two parent hashes (main and feature-a).
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
force git to create a merge commit even if fast-forward is possible
git merge --no-ff feature-branch05 / CHECK YOURSELF
Could you explain Branching & Merging to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in Git & collaborationRebase vs Mergetwo ways to combine work