SyntaxStudy
Sign Up
Home Git Reference git merge

git merge

command

Merges the specified branch into the current branch. Creates a merge commit unless fast-forward.

Syntax

git merge <branch>

Example

bash
# Merge feature into main
git switch main
git merge feature/login

# No fast-forward (always create merge commit)
git merge --no-ff feature/login

# Abort merge on conflict
git merge --abort

# Squash all commits into one
git merge --squash feature/login