1

I have found that I only see branches and the right project topology when using either gitk, sourcetree or git log if I am collaborating with other developers.

But when I work alone and I create branches by using git checkout -b branchName, then I cannot see any branch in any of those visual representation tools.
It looks like I have been working only in master, no branches are represented.

What am I doing wrong? I expect to see my branches appearing, when I create them or merge them back with other branches or master.

Am I misunderstanding how git works?

Further explanation:

enter image description here

I expect to see something like this where all my branches are represented:

enter image description here

Thanks a lot

danivicario
  • 1,673
  • 1
  • 16
  • 23

1 Answers1

3

gitk takes the same arguments that git log.

So if you want to see all (local) branches, you should at least use:

gitk --branches.

I like to see the remote branches as well:

gitk --branches --all

What the OP prussian-blue didn't see was:

What I want is to see something like the second screenshot, not the first one. I expect to see testinscroll in parallel to master, as testingscroll was branched out from master in the first commits of the project.

What I suspect (and answered) is:

you won't see that, because the merge from testingscroll to master was a fast-forward one, as explained in "Why does git use fast-forward merging by default?" : master HEAD has just been moved to testingscroll, making the two branches identical.

What would preserve the two branches, keeping them separate until the merge, would be:

git merge --no-ff testingscroll
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sorry, tried this but still I see the same unexpected result, with no branches being represented. Please, take a look at the screenshot I posted in my last edit of this post. Thanks a lot. – danivicario Mar 26 '13 at 14:11
  • @prussianblue on what branch are you currently on? (what does `git branch` returns?). Your screenshot shows both `master` and `testinscroll` branches. – VonC Mar 26 '13 at 14:14
  • I am in master. Also tried switching to testingscroll branch and I see the same result. What I expect to see is my branch testingscroll in parallel to master, until the final merge in the last commit. Makes it sense? – danivicario Mar 26 '13 at 14:21
  • @prussianblue so... what you see is correct then: both `master` and `testingscroll` are pointing to the same commit (fast-forward merge for `master`: see http://stackoverflow.com/questions/2850369/why-does-git-use-fast-forward-merging-by-default/2850413#2850413) – VonC Mar 26 '13 at 14:23
  • Many thanks Vonc, I updated the post including a seconds screenshot. What I want is to see something like the second screenshot, not the first one. I expect to see testinscroll in parallel to master, as testingscroll was branched out from master in the first commits of the project. – danivicario Mar 26 '13 at 14:27
  • @prussianblue you won't see that, because the merge from `testingscroll` to `master` was a fast-forward one, as explained in the link I mentioned before: http://stackoverflow.com/questions/2850369/why-does-git-use-fast-forward-merging-by-default/2850413#2850413 : `master` HEAD has just been moved to `testingscroll`, making the two branches identical. – VonC Mar 26 '13 at 16:46
  • 1
    Thank you very much indeed, this is the relevant answer! Cool! The answer was here http://stackoverflow.com/questions/2850369/why-does-git-use-fast-forward-merging-by-default/2850413#2850413 as you said! Git merge --no-ff branchName did exactly what I wanted! – danivicario Mar 26 '13 at 17:28
  • @prussianblue Excellent! I have included those comments in the answer for more visibility. – VonC Mar 26 '13 at 17:48