0

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?

knot22
  • 2,648
  • 5
  • 31
  • 51
  • Note that people use the word *branch* in an ambiguous manner, when working with Git. See [What exactly do we mean by "branch"?](https://stackoverflow.com/q/25068543/1256452) (This is a side remark; [Marcus Müller's answer](https://stackoverflow.com/a/71385497/1256452) is correct.) – torek Mar 09 '22 at 01:22

1 Answers1

1

The former, i.e., parent tracking.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94