Merging in Git
From the Git cheat sheet · Branching · verified Jul 2026
Merging
Combine changes from one branch into another
bash
# Merge a branch into current
git merge <branch>
# Common variants
git merge --no-ff <branch> # Always create a merge commit
git merge --ff-only <branch> # Fail if can't fast-forward
git merge --squash <branch> # Squash into one commit (then commit)
# Bail out of a merge in progress
git merge --abort💡 Fast-forward keeps history linear; --no-ff records the merge explicitly
⚡ Use --squash when you want a clean single-commit history
✅ Test after merging before pushing
🔧 --abort returns to the pre-merge state