A merge incorporates another history into the current branch. For this example, assume map-key has a new committed change and main has not advanced since that branch was created. The previous lesson created the name but did not create that commit. Start with a clean working tree and switch to the receiving branch first:
git status
git switch main
git merge --ff-only map-key
Here --ff-only permits the merge only if main can advance directly to map-key. For example:
before: A---B main
\
C map-key
after: A---B---C main, map-key
C already descends from B, so moving main to C is a fast-forward; no merge commit is needed. The source name remains at C.
Now consider a different situation: main and map-key each have a new commit since their shared ancestor B. A fast-forward-only merge stops. After inspecting the history, a regular git merge --no-edit map-key on main normally combines the changes since a best common ancestor and creates a merge commit if the changes combine cleanly:
D-------M main
/ /
A---B---C----- map-key
M has two parents, D and C. --no-edit accepts Git’s proposed merge message; without it an editor may open. The graph is schematic, not literal output. Merge combines changes rather than replaying every commit; project configuration can affect merge behavior. Review the files and run relevant tests even when Git reports success.