简体   繁体   English

跟踪 Git 分支中的提交

[英]tracking commits in a Git branch

In a quest to understand Git branches, I've come across the following, cited from this page - toward the bottom ,为了了解 Git 分支机构,我遇到了以下内容, 从该页面引用 - 朝向底部

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.因为 Git 中的分支实际上是一个简单的文件,其中包含它指向的提交的 40 个字符的 SHA-1 校验和,所以创建和销毁分支的成本很低。

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.在我的一个项目的 Git 存储库中,当我打开这个文件.git\refs\heads\master时,该文件中唯一的东西是一个 40 个字符的 SHA-1,它验证了上述声明。

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 .假设在名为feature-400的分支中有 12 次提交。 Are they chained together by each commit keeping track of its parent or does the branch itself somehow track this history?它们是通过跟踪其父项的每个提交链接在一起的,还是分支本身以某种方式跟踪此历史记录的?

The former, ie, parent tracking.前者,即父母追踪。

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

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