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.
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 current branch to the last commit of the branch that is being merged.
This process is depicted in the following diagram. The first picture assumes that the master branch is checked out and you want to merge the changes of the branch labeled branch into...