Skip to main content

Merging

Merging is the process of combining two branches into one.

Keeping your code in branches helps safely make changes without affecting the primary branch.

This allows you to merge changes into the final product when the new code is ready.

src

Merge

When you merge a branch, Git creates a new commit that combines the changes from the two branches.

git merge branchname

This will prompt a merge commit message.

Fast Forward

If the Tip of the branch you are merging into is a direct descendant of the branch you are merging, Git will perform a fast-forward merge.

This means that the new branch has all the commits of the old branch and the new branch pointer will move to the new commit.

It moves the pointer of the base branch to the tip of the new branch.

    C new branch
/
A-B master
            new branch
A - B - C master