Git Merge: When You Want Real History (Safely)
git merge combines two branches.
If your feature branch and main diverged, Git creates a merge commit that has:
- one parent from the feature branch
- one parent from
main

The most common merge command
git switch main git merge feature/auth
Fast-forward vs merge commit
- Fast-forward happens when
mainhasn’t moved since you branched off. Git just moves the pointer. - Merge commit happens when both branches have new commits. Git preserves both histories and records the merge.
Next: merge vs rebase
For the deeper “which one should you use and when” answer: