4 ms·
> Branches are pointers to Commit objects Nit: the data model has refs, which are pointer to objects. Branches are the subset of refs in the special-cased hea
by masklinn 3y ago
> Branches are pointers to Commit objects
Nit: the data model has refs, which are pointer to objects.
Branches are the subset of refs in the special-cased heads/ namespace which should be pointing to commit objects.
And there’s also tags, which are the subset of refs in the special-cased tags/ namespace, which should be pointing to commit (“lightweight”) or tag (“annotated”) objects.
- AceJohnny2 3y agoAbsolutely. Going further, the little-known git-notes [1] feature also uses its own reference namespace, `refs/notes/` Going even further, Gerrit [2] leverages the wide-open reference namespace/directories to create its own. For example, pushing under the `refs/for/` namespace creates a new review, and specific reviews can be looked up under the `refs/changes/` namespace. Even even further, Gerrit's special repos All-Users.git and All-Projects.git are "databases" for project configuration and user configuration, where for example external IDs (like usernames) are stored under the special `refs/meta/external-ids` ref/branch. This has the notable benefit that all configuration changes are tracked and auditable. I believe git-appraise [3] also leverages special reference namespaces in Git for performing its review duties (but I don't know details) Edit: actually no, it "just" leverages git-notes. [1] https://git-scm.com/docs/git-notes https://git-scm.com/docs/git-notes [2] https://gerrit-review.googlesource.com/Documentation/note-db.html https://gerrit-review.googlesource.com/Documentation/note-db... [3] https://github.com/google/git-appraise https://github.com/google/git-appraise
- masklinn 3y agoGitHub also leverages refs, for each PR there are two magical refs in refs/pull/<number>/ which point to the PR’s head and its prospective merged head