Git 提交对特定分支的归属感
Git Commit belongingness to a particular branch
我在 master
分支上有 7 个提交(比方说),并使用“git checkout <commit_hash>
”移动到第 4 个提交,HEAD 现在处于分离状态。
我从第 4 号提交中使用分离的 HEAD 进行了 3 次新提交,并在那里创建了一个新分支“dev
”。
然后我检查到 dev
并再次进行了新的提交。
现在我可以说从这个 dev
分支提示提交到项目的根提交的所有提交都属于 dev
分支或者只属于 dev
提示提交和上一个提交属于 dev
个分支?
提交到分支的归属感是什么概念?
"belongingness" 是:任何可从 dev
HEAD 到达的提交。
所以来自 dev
的所有提交和来自 master
的提交,其中创建了 dev
。
看我之前的回答“How to list branches that contain a given commit?", using git branch --contains
:
With --contains
, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit)
m--m--m--m1--m--m
\
d1--d--d--d
git branch --contain m1
会同时显示 dev
和 master
git branch --contain d1
只会显示 dev
我在 master
分支上有 7 个提交(比方说),并使用“git checkout <commit_hash>
”移动到第 4 个提交,HEAD 现在处于分离状态。
我从第 4 号提交中使用分离的 HEAD 进行了 3 次新提交,并在那里创建了一个新分支“dev
”。
然后我检查到 dev
并再次进行了新的提交。
现在我可以说从这个 dev
分支提示提交到项目的根提交的所有提交都属于 dev
分支或者只属于 dev
提示提交和上一个提交属于 dev
个分支?
提交到分支的归属感是什么概念?
"belongingness" 是:任何可从 dev
HEAD 到达的提交。
所以来自 dev
的所有提交和来自 master
的提交,其中创建了 dev
。
看我之前的回答“How to list branches that contain a given commit?", using git branch --contains
:
With
--contains
, shows only the branches that contain the named commit (in other words, the branches whose tip commits are descendants of the named commit)
m--m--m--m1--m--m
\
d1--d--d--d
git branch --contain m1
会同时显示dev
和master
git branch --contain d1
只会显示dev