Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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,

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

>Solution :

The former, i.e., parent tracking.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading