← Git from Scratch Lesson 10 of 17 · 10 XP

Merging: fast-forward

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

When the work in a branch is ready, it is merged into the main branch:

git switch main            # go to the branch you're merging INTO
git merge feature          # merge feature into the current branch

If main has had no new commits since feature was created, the merge is trivial. Git simply moves the main pointer forward to the last commit of feature. This is a fast-forward: no new commit appears, and the history stays a straight line.

before: A ── B          ← main
              ╲
               C ── D   ← feature

after:  A ── B ── C ── D   ← main, feature

Task. The feature branch already has two finished commits. Merge it into main.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.