This is the second video in the Git Animated series. If you are interested in the other ones, check the links below:

In this video you will see what happens when we merge two histories, specifically merging feature into master. The thing to note here is that the merge is a fast-forward one, this is possible when there are no further commits on the branch we branched off of, after the point of creating the new branch (in our case on the branch master after commit M2).

Additionally, after feature has been successfully merged into master, we delete the feature branch, this is not a must, but is a good practice to keep your repository clean.

Hopefully this animation conveys some intuition on what happens when we merge two histories using the fast-forward strategy.

For your convenience, here are the Git commands which appear in the video:

git commit -m 'M0'
git commit -m 'M1'
git commit -m 'M2'
git branch feature
git checkout feature
git commit -m 'F0'
git commit -m 'F1'
git commit -m 'F2'
git checkout master
git merge feature
git branch -d feature

Here is the video(there is no audio):


Feel free to drop me a comment or e-mail with your constructive criticism. It will be much appreciated!

Enjoy!

Vlad