1

Here is my commit history with git log --pretty=%h --graph (the order of commits goes from bottom to top)

* 81e1852 <- I have merged back in twice to get to this
* b6cb648
* 3ef6e0b
* a1f56c5
* a35a50a
* 47b2058 <- I have made a couple of branches since here
* 43c1912
*   19d189f <- Here I merged back in
|\
| * 837998b
| * 30c0a6c
| * e667ee8
| * f41ccfa
* | 54bd96c <- Here I branched off
|/
* 407af14
* 7951cdf
* a8db147 <- This was my first commit

As you can see, a few commits after my initial commit I branched off, made some changes and then merged back in. I have then done the exact same thing twice since commit 19d189f but this is not reflected in the history.

Clearly I must have done something different, do you know what that might have been? I have not rebased, I am still learning Git and rebasing is not something I have attempted yet. It is possible that I had to resolve some conflicts when I merged 19d189f, could this be why this branch appears in my history but others don't? Also note that I currently have no branches other than master and I am working entirely locally.

Thanks

punkrockbuddyholly
  • 9,675
  • 7
  • 36
  • 69
  • 2
    Most likely explanation: the "missing" merges were actually *fast-forward* merges, as opposed to "true" merges; see https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging. – jub0bs May 19 '15 at 11:17
  • @Jubobs Ok, so what would cause the first branch/merge to not be a fast-forward merge? – punkrockbuddyholly May 19 '15 at 11:18
  • 1
    Presumably, the two branches had diverged (new commits were created on the two branches). In that case, a fast-forward is not possible. – jub0bs May 19 '15 at 11:19
  • 1
    You can always add `--decorate` flag to view the name of the branches and tags – CodeWizard May 19 '15 at 11:26
  • @codeWizard if I do that I don't get any information about the branches, it simply tells me that my latest commit is (HEAD, master). After merging my branches I have deleted them, is this why? – punkrockbuddyholly May 19 '15 at 11:29
  • There might be several reasons why. (deleted/merges/fast-forward branches/revert and even more reasons ) just to make life easier :-) but basically its one of 2: your code is merged or not. That's the bottom line. – CodeWizard May 19 '15 at 11:31

1 Answers1

1
* | 54bd96c 

This is the single time when you commited both in your master branch and a feature branch. A usual merge was used, resulting in this commit:

*   19d189f <- Here I merged back in

In all other cases you merged a branch, having no commits made to master since the branch point. A fast-forward merge was used, which doesn't create a merge commit. So there's nothing seen on the graph.

Also, see Why does git fast-forward merges by default?

Community
  • 1
  • 1
Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67