

#GIT TAG SEMANTIC VERSIONING SERIES#
This is in some ways similar to the way git notes work, but instead of writing files whose names are the IDs of commits, you are simply writing a file named "marks" (stored via a tree that is then pointed-to by the commit, that the mark reference-whether it's a tag like refs/tags/marks, as in the tag example above, or a reference like refs/marks, like the m series references above but only using one reference). If you store the blob under a commit, you can keep a history of marks by making new commits for each new updated "marked IDs" file. Git tag -f marks $(git hash-object -w -stdin < /tmp/all-marks) Git rev-parse HEAD > /tmp/all-marks # add a new mark For instance: git show marks > /tmp/all-marks # extract existing marks The file itself can be stored in a tagged or otherwise-referenced commit that may, but need not be, on any branch or you can tag the blob itself. Īlternatively, you might store, in or outside the repository, and if inside the repository, in a plain blob-a blob is Git's internal format for raw file data-a file that simply contains the hash IDs of all "marked" commits. mark N is not between those two points (inclusive).

mark N is at or beyond tag T1 and at or before HEAD. Git merge-base -is-ancestor refs/marks/m$N HEAD then

To test if mark $N is "between" tag T1 and HEAD: if git merge-base -is-ancestor T1 refs/marks/m$N & (this assumes you never delete, with git update-ref -d, any of these marks-if you do the "high mark" computation must find the highest existing number instead of simply counting). Git update-ref refs/marks/m$nextmark HEAD Or, you can use reference names that are not in refs/tags/ or you could use Git's "notes", although it's easier to detect whether a tag or other reference is an ancestor of one commit and a descendant of another: highmark=$(git for-each-ref -format='%(refname)' refs/marks | wc -l) It's true that tag names must be unique-but there are an infinite number 1 of unique tag names beginning with mark/, such as mark/1, mark/2, and so on.
