[Git] Bring another branch's changes into the current branch

Created on November 30, 2026

Use git merge to integrate another branch into the branch you have checked out. This example merges feature into main.

git checkout main
git merge feature

If main is an ancestor of feature and fast-forwarding is permitted, Git moves main to the feature tip. This is an example of the output from a fast-forward merge.

Updating f1b459a..acb4804
Fast-forward
 file.txt | 1 +
 1 file changed, 1 insertion(+)

If the branch is already merged, Git prints Already up to date..

Create a merge commit

Pass --no-ff to create a merge commit even when a fast-forward is possible, as long as there is something to merge.

git merge --no-ff feature

If the source of the changes is a remote branch, fetch the remote first to work with its latest state.

Reference

Git