Tuesday 15 February 2011

git - gitflow, tags an versions numbers -



git - gitflow, tags an versions numbers -

i need 2 thing work project: clear branching model, , way accurately track origin of binaries.

i want follow gitflow branching model, wich seems suits need.

for origin of binaries, utilize git describe --dirty in makefiles, generate string wich stored in binaries. way, running executable --version alternative tells me exactly comes from.

everything seemed work fine until seek utilize both of these: binaries built master, works perfectly. have clean version number, name of lastly tag. however, when compile branch, there no tag in ancestors, no usefull string produced git describe...

i know there --always alternative wich output sha-1 if no tag si found, want "v1.3.2-15-3b7bf9f", instead of "3b7bf9f".

how can create tag on master accessible other branches? thought merging master develop after every tag pushed on master, i'm not sure it's safe...

am missing something, or gitflow , git describe sort of "incompatible"? how can prepare this?

git describe can't this, because commit you're on has nil tags on master. except merges branch master.

first, you'll need find commit merge base of operations current branch , master:

$ export mergebase=`git merge-base head master`

this save on mergebase commit want (using bash).

next, you'll merge commit on master (using git rev-list) , can antecessor tag merge commit:

$ export tag=git rev-list --merges --max-count=1 ${mergebase}..master | xargs git describe --tags --abbrev=0

finding commit hash of head:

$ export commit=`git rev-parse head`

and latest equivalent tag on master commit in:

$ echo "${tag}-${commit}"

git version

No comments:

Post a Comment