LESSON 1.18 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Merge vs rebase
Watch two branches join: one merge commit, or rebased copies with new hashes.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 1.18 · GIT BAYFEATURE: 2 AHEAD · 1 BEHIND
01
Stage 1 of 6 · Two branches
Each commit stores a full snapshot. The branch feature is 2 commits ahead of main and 1 behind.
Explain it simply
Each box is a commit, a saved copy of all the files. The table shows the files in each one. Feature added X and Y, and then main added B, which changes data.py. So feature has 2 commits that main doesn't have, and main has 1 that feature doesn't.
Commit A starts both branches. Feature adds X and Y. Main adds B, which changes data.py. Feature is 2 ahead and 1 behind.
commit, file linehash, parent link, branchnew commit, resultconflict, left behindno file, not written
Toy: 3 one-line files · 4 commits, then a merge or a rebase · real Git SHA-1 ids
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Ahead counts commits only feature has; behind counts commits only main has.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 2 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.