跟踪 Git 分支中的提交

发布于 2025-01-12 07:41:26 字数 676 浏览 1 评论 0原文

为了了解 Git 分支,我遇到了以下内容, 从此页面引用 - 向底部

由于 Git 中的分支实际上是一个简单文件,其中包含它所指向的提交的 40 个字符 SHA-1 校验和,因此创建和销毁分支的成本都很低。

在我的一个项目的 Git 存储库中,当我打开此文件 .git\refs\heads\master 时,该文件中唯一的内容是 40 个字符的 SHA-1,它验证了上述语句。

现在,下一部分,从此页面引用 - “分支”的定义,就是我所拥有的一个关于 - 的问题

“分支”是一条发展线。分支上的最新提交称为该分支的提示。分支的尖端由分支头引用,分支头随着分支上完成的额外开发而向前移动。

假设名为 feature-400 的分支中有 12 个提交。它们是否通过每个提交跟踪其父级而链接在一起,或者分支本身是否以某种方式跟踪此历史记录?

In a quest to understand Git branches, I've come across the following, cited from this page - toward the bottom,

Because a branch in Git is actually a simple file that contains the 40 character SHA-1 checksum of the commit it points to, branches are cheap to create and destroy.

In a Git repo of one of my projects, when I open this file .git\refs\heads\master, the only thing in that file is a 40 character SHA-1, which verifies the above statement.

Now this next part, cited from this page - definition for "branch", is what I have a question about -

A "branch" is a line of development. The most recent commit on a branch is referred to as the tip of that branch. The tip of the branch is referenced by a branch head, which moves forward as additional development is done on the branch.

Say there are 12 commits within a branch called feature-400. Are they chained together by each commit keeping track of its parent or does the branch itself somehow track this history?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

摘星┃星的人 2025-01-19 07:41:26

前者,即家长追踪。

The former, i.e., parent tracking.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文