简体   繁体   中英

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:

在吉特克

在此处输入图片说明

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

在此处输入图片说明

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

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM