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

Commit message: "[Super Theme] upgraded Navigation to include hover effect"
Branch super_theme-upgrade-navigation-hover

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.

  • Get the nth commit/version from GIT local Repo
  • Automatic version number both in (setuptools) AND source code?
  • Automatically include the current version number when compiling
  • How to remove deleted files from git?
  • .gitignore is refusing to ignore a folder
  • Managing Versions
  • How can I get the Git build number and embed it in a file?
  • catch 22 with git permissions for private repos
  • 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.

    Git Baby is a git and github fan, let's start git clone.