简体   繁体   English

Git图形:将分支显示为线性,而不是显示为master的分支(我认为)

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

I have two branches: master & develop . 我有两个分支: masterdevelop Develop diverges from master after the second commit on master and has own 3 commits. Develop从发散master后的第二次提交的主人和拥有自己的3个提交。 However the graph in gitk as well as in command line is shown as linear as below: 但是, gitk和命令行中的图形显示为线性,如下所示:

在吉特克

在此处输入图片说明

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上没有并行的工作上“分歧”。 master still contains a subset of the changes on develop . master仍然包含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. 如果在master上添加提交,则Git(和gitk)将使用fork渲染图。

Both pics show the same thing. 两张照片都显示相同的内容。 When you create a branch on git (unlike, say, svn), there's no new revision being created. 当您在git上创建分支(不同于svn)时,不会创建新修订。 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. 如果您随后在master上提交其他内容,您将能够看到分支分歧。 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. 但随后master是这些修订版之一的指针

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. 同样的想法也适用于Git提交图。 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. 以及同一图形的直线版本:它们以任何一种方式表示同一图形。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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