1

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

xBACP
  • 531
  • 1
  • 3
  • 17
  • Add `--decorate` so that Git shows you the labels associated with commits. Otherwise, while you'll see the commit to which the label `foo2` *points*, you will just have to know that `a9578d3` is that particular commit. (Hash ID made up of course.) Remember, branch *names* are mainly just labels that save IDs for you. – torek Mar 29 '17 at 01:08
  • http://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff Did a small experiment. This is it. – xBACP Mar 29 '17 at 02:05
  • With `--decorate` you will see *both* labels pointing to the commit, so `--decorate` is still the answer to "how do I see the label". Whether and when you want a real merge vs a fast forward is a separate question from "how do I see the graph with labels". I read your question as asking "how do I see the graph with labels". – torek Mar 29 '17 at 06:24

2 Answers2

0

You won't see any reference to foo2. Only the commits that were merged into develop from foo2.

Gordon Bockus
  • 860
  • 6
  • 11
  • I see online that some people have theirs showing different branches and how they merge/diverge. Am I seeing them correctly? – xBACP Mar 29 '17 at 01:16
  • The other commenter has a flag for showing the branch associated with commits. Please provide the link to examples if that doesn't meet your needs – Gordon Bockus Mar 29 '17 at 01:18
  • I tried: git log --graph --decorate. Still seeing just one straight line :(. The examples I was referring to are like here: http://stackoverflow.com/questions/1057564/pretty-git-branch-graphs – xBACP Mar 29 '17 at 01:23
  • I looks like not using the --no-ff flag for git-merge may have something to do with it... – xBACP Mar 29 '17 at 01:44
  • 1
    The answer is here: http://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff – xBACP Mar 29 '17 at 01:48
0

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
Marina Liu
  • 36,876
  • 5
  • 61
  • 74