appu
appu

Reputation: 481

Git graph: develop branch shown as linear instead of as a diverged branch of master (that I think)

I have two branches: master & develop. Develop diverges from master after the second commit on master and has own 3 commits. However the graph in gitk as well as in command line is shown as linear as below:

In Gitk

enter image description here

I believe it should resemble more like a branch something like the below:

enter image description here

I am still learning the basics and not even sure whether my interpretation of what a branched graph should look like is even the right way or not.

thanks app

Upvotes: 1

Views: 1005

Answers (3)

user229044
user229044

Reputation: 239270

They have not "diverged" in the sense that there has been no parallel work on master. master still contains a subset of the changes on develop. There is no value at all in rendering a curved line in this case.

The graph you're expecting to see will only occur if both branches contain commits after the point at which they diverge. If you add a commit on master, Git (and gitk) will render the graph with a fork in.

Upvotes: 4

torek
torek

Reputation: 488013

What's the difference between a donut and a coffee cup?

To a topologist, they are the same thing! (Which is why topologists keep trying to dunk their coffee mugs into their donuts.)

This same idea holds for Git commit graphs as well. There's no difference between:

o--o--o
       \
        o--o--o

and the straight-line version of the same graph: they represent the same graph either way.

Upvotes: 3

eftshift0
eftshift0

Reputation: 30174

Both pics show the same thing. When you create a branch on git (unlike, say, svn), there's no new revision being created. It's just a new pointer to a revision (the same one master was on when the other branch was created). You start committing on the other branch, it's a linear flow. If you then commit something else on master, you would be able to see the branches diverge. Think of it this way: forget about where master is. If you wanted to see the history of the other branch, it would be a straight sequence of revisions. But then master is a pointer to one of those revisions.

Upvotes: 1

Related Questions