Merging

A very nice process in Git allows you to combine the changes of two branches. This is called merging.

The git merge command performs a merge. You can merge changes from one branch to the current branch via the following command. Your local master branch is created as a tracking branch for the master branch of the origin repository:

Erik@local:~/webproject$ git checkout master
Erik@local:~/webproject$ git merge test

This command will merge test branch changes inside your current checked-out branch.

Fast forward merge

If the commits that are merged are direct predecessors of the HEAD pointer of the current branch, Git simplifies things by performing a so-called fast forward merge. This fast forward merge simply moves the HEAD pointer of the ...

Get Git Best Practices Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.