Search code examples
gitversion-controlgit-mergegit-log

Proper Git merging as is relates to repo history


Here is the scenario:

I have one branch named 'develop'. I branch off from this branch, the new branch is 'foo2'. After 3 commits on foo2, I then checkout develop branch and merge the changes on foo2 into develop:

git merge foo2

I then run:

git log --graph

I do not see foo2 in the graph. Did I do something incorrect with merging? Or is it something else entirely?

The branch foo2 still exists


Solution

  • Because it’s fast forward merge. The graphs to illustrate as below:

    …---A            develop
         \
          B---C---D  foo2
    

    After git merge foo2, develop and foo2 are both point to commit D, so you just find the graph as a line:

    …---A---B---C---D       develop/foo2
    

    And you can use any of below command to view it more clearly:

    git log --oneline --decorate --graph --all
    gitk --all