Situation
We have a git workflow where all release versions fit into a branch master, and when the commit is ready for deployment, we add a tag to it and then use it git archiveto build the package for deployment.
We use the file version.txtmarked in the .gitattributesoption export-substto track which commit was used to create this archive.
Question
If I write $Format:%d$to version.txtand export a tagged commit, I will have something like (HEAD, tag, master)that written in the resulting file.
How can i use only tag?
[edit] There is a git command that already produces this:
git describe
This will output:
latest_tag #if HEAD is tagged
latest_tag-5-g03cc91b #if HEAD is not tagged,
#and the latest tag is 5 commits ago on commit g03cc91b
Is there any way to replace slug with this output in version.txt?