问题描述
我回到了一个旧项目,并且运行了不错的 git status
来了解发生了什么,并且我注意到分支太多了!我想先做一些整理工作,然后再开始进行此工作,但是我不确定哪个分支来自哪个分支。
I got back on an old project and I ran the nice git status
to figure out what was going on and I noticed way too many branches! I want to do some housekeeping before starting to work on this again but I'm not sure which branch comes from which..
E.G。 branchA是否源自 develop?
E.G. Does "branchA" derive from "develop"? Does "branchB" derive from "master" or "branchA"??
如何回答上面的示例问题?
How can I answer the sample questions above?
推荐答案
对此没有规范的答案,因为分支只是DAG中某些提交的指针。例如, master
和 foo
可能指向同一提交;如果您随后从 foo
创建分支,则实际上与从 master
创建分支相同。
There's no canonical answer for this, since branches are simply pointers to certain commits in a DAG. For instance, master
and foo
could be pointing at the same commit; if you then create a branch from foo
, it's effectively the same as creating a branch from master
.
也就是说,如果您可视化提交图(通过 gitk
或其他图形化历史工具),则可以大致了解分支点在提交图中的位置,以及各种分支指针所指向的位置。
That said, if you visualize the commit graph (via gitk
or some other graphical history tool), you can get a general sense of where the branch points are in the commit graph, versus where various branch pointers are pointing.
这篇关于我从哪里分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!