哪个分支从一个被删除的分支提交属于? [英] Which branch do commits from a deleted branch belong to?
问题描述
如果我将分支A合并到分支B中,然后删除A,哪个分支从分支A提交(现在删除)属于?
div> Git分支仅仅是提交的指针。询问
这个提交属于哪个分支?
没有任何意义(至少在一般情况下),因为提交可能很容易从多个分支(甚至根本就没有!)获得。
考虑下面的例子:
提交 然后提交 提交 F
目前只能从 bugfix code>分支;在这一点上,有意义的说,提交
属于 F
属于 bugfix
分支。但是,如果您然后通过运行
>将 bugfix
合并到 master
中, git checkout master
git合并bugfix
F
可以从这两个分支到达: b
$ b
F 不能再被认为属于
。 bugfix
多于
如果你删除 bugfix
,commit F
将只能从一个分支 master
这次,在这种情况下,可以说commit master
。
总之,一般来说,提交不能被认为是专属属于任何一个分支。然而,总是确实有意义的问题是
从哪个分支(如果有的话) ?
If I merge branch A into branch B and then delete A, which branch do commits from branch A (now deleted) belong to?
Git branches are mere pointers to commits. Asking
Which branch does this commit belong to?
doesn't really make sense (at least, not in the general case) because commits may very well be reachable from multiple branches (or even from none at all!).
Consider the following example:
Commit F
is currently only reachable from the bugfix
branch; at this point, it makes sense to say that commit F
"belongs" to the bugfix
branch. However, if you then merge bugfix
into master
, by running
git checkout master
git merge bugfix
then commit F
becomes reachable from both of those branches:
Commit F
can no longer be said to belong to bugfix
more than to master
.
If you then delete bugfix
, commit F
will again be reachable from only one branch, master
this time, in which case it will make sense to say that commit F
"belongs" to master
.
In summary, a commit cannot, in general, be thought of as exclusively belonging to any one branch. However, a question that always does make sense is
From which branches (if any) is this commit reachable?
这篇关于哪个分支从一个被删除的分支提交属于?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!