Consider this git repository example.
rm -rf example
git init example
cd example
echo 0 > file.txt
git add file.txt
git commit -am "initial commit"
git branch branch1
echo 1 > file.txt
git commit -am "1 (on master)"
git branch branch2
git checkout branch1
echo 2 > file2.txt
git add file2.txt
git commit -m "2 (on branch1)"
git merge --no-edit master
echo 3 > file2.txt
git commit -am "3 (on branch1)"
git checkout master
echo 4 > file.txt
git commit -am "4 (on master)"
git checkout branch1
git merge --no-edit master
echo 5 > file2.txt
git commit -am "5 (on branch1)"
git checkout master
git merge --no-edit --no-ff branch1
git log --graph --oneline
We create a branch branch1, weld it from the branch a mastercouple of times, and finally return to master.
git log --oneline --graph looks strangely twisted.
* 2c3b97a Merge branch 'branch1'
|\
| * 1d722df 5 (on branch1)
| * 54039b6 Merge branch 'master' into branch1
| |\
| |/
|/|
* | d80d82c 4 (on master)
| * 2399286 3 (on branch1)
| * 9a0cb38 Merge branch 'master' into branch1
| |\
| |/
|/|
* | 31df841 1 (on master)
| * 5809072 2 (on branch1)
|/
* 08fc7a6 initial commit
The graph will be simpler if it looks like this:
* 2c3b97a Merge branch 'branch1'
|\
| * 1d722df 5 (on branch1)
| * 54039b6 Merge branch 'master' into branch1
|/|
* | d80d82c 4 (on master)
| * 2399286 3 (on branch1)
| * 9a0cb38 Merge branch 'master' into branch1
|/|
* | 31df841 1 (on master)
| * 5809072 2 (on branch1)
|/
* 08fc7a6 initial commit
The reason I understand it is not like I git logalways prefer to show the “second parent” of each merge merge on the right side, so for each commit merge it has a snake to the right. ("Second parent" is the merging of branches, "first parent" is the branch we are joining.)
git log , ? 2013 ( " , ", ), .- ,
git log , git , ?