tracking version numbers of subfolders in git
My team is using github to manage a private repo full of cms themes. We have them all within the same repo and keep track of them with subfolders, labels and keeping our branchs and commits prefixed with the theme name
"[Super Theme] upgraded Navigation to include hover effect"
- Git shortlog exclude comments starting with string
- How to make “git describe” mention the presence or absence of local changes?
- Opposite of .git/info/exclude - including files that are excluded by .gitignore
- How to ignore mistakenly committed files
- How do I maintain the version number of my bash script which is git source controlled?
- “unknown revision or path not in the working tree” when trying to fetch specific commit to new directory
Now we want to introduce semantic versioning into the theme’s settings page so if you click about, you get the version number, but I’m not sure the best way to implement this
We could use git tags and git describe to check the number of commits but this only works if each folder is its own repo. We want to keep them together because it makes discussions on github easier since an issue affecting one theme often affects another. They’re all different, but very closely related.
I thought about adding a script for us to check the current version of in the theme’s json file and incrementing it, but I’m not sure if this is automatic enough. I really want to be sure that we don’t run into version conflicts with everyone on the team. Not sure if submodules would work here since we want them always up to date.
I want a way to update the version number for a subfolder only when a branch working on that folder is merged into master.
Stumped. I’m not even sure if thats a clear question, so please ask for clarification.
One Solution collect form web for “tracking version numbers of subfolders in git”
It is actually possible to tag objects other than commits. You could therefore tag the tree of your sub-folder like this (the
-a is optional):
git tag path/to/subfolder/v-1.2.4 HEAD:path/to/subfolder -a
To find out the version for the sub-folder in a particular commit use the following:
git for-each-ref refs/tags/path/to/subfolder/ --format='%(object) %(refname:short)' | grep $(git rev-parse <commit>:path/to/subfolder) | cut -c 41-
However, unlike git describe, this will not give you the most recent version unless there is an exact match.