git merge
Joins two or more development histories (branches) together.
Syntax
git merge [<options>] <branch>...
Options
- --no-ff: Creates a merge commit even when fast-forward is possible
- --ff-only: Refuses to merge unless fast-forward is possible
- --squash: Squashes all commits into a single set of changes without creating a merge commit
- --abort: Aborts the current merge and restores the pre-merge state
- --continue: Continues the merge after resolving conflicts
- -m <message>: Sets the merge commit message
Example
git merge feature/login git merge --no-ff feature/login git merge --squash feature/login
Tip
Use --no-ff to preserve branch history in the commit graph.