gitjenkinsbranching-and-merginggit-flowgit-describe

git describe not suitable for git flow process?


I plan to migrate several services to a git repository. For releasing I want to go with git flow process. A Jenkins build will build artifacts from every existing branch. To track the version every build tags the version at the corresponding node, where the build was triggered.

Unfortunately I ran into troubles when merging back the master branch into develop after a release was finished.
After the back merge git describe gives me the tag from the master branch, which is not the tag Jenkins should build the next version on develop (develop integrates the next release already with some other pre-release tags).

Is there a way to tell git describe not to track "merged tags"? Or is there another git command I have to use in this situation?


Solution

  • Ok I found the answer.
    (It's always after posting the question, regardless of how long I searched before.)
    A very old blog with a very important comment

    –first-parent option was added to git describe

    git-describe --first-parent

    --first-parent Follow only the first parent commit upon seeing a merge commit. This is useful when you wish to not match tags on branches merged in the history of the target commit.