Git - Merge

About

Merge is designed to integrate changes from one branch into another branch

It joins two or more branch together (ie development histories)

The pull command can also merge. See Fork Pull

Example

Imagine this commit history (log) with a remote and a local branch where the commit in the remote branch will be integrated into the local branch.

- A - B - C - D - remote HEAD
    \
      E - F - G - local HEAD

After a merge, the commit history (log) will look like:

- A - B - C - D - remote HEAD
    \                         \
      E - F - G - local HEAD - new local HEAD

rebase is also designed to integrate changes to get an easier commit log: See What is the difference between a merge and a rebase?

Management

Merge from master to the feature branch

git checkout feature
git merge master

# or in one liner
git merge master feature

Merge from a fork


Powered by ComboStrap