Home > Blockchain >  tracking commits in a Git branch
tracking commits in a Git branch

Time:03-08

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?

CodePudding user response:

The former, i.e., parent tracking.

  • Related