0

I would like to get result of execution some shell command (git rev-list HEAD --count) like a content of tag. Something like this:

<git-count>git rev-list HEAD --count</git-count>

Is there a way to do that?

Bob Gilmore
  • 12,608
  • 13
  • 46
  • 53
  • You know that `git rev-list HEAD --count` doesn't unambiguously identify a commit? Regardless of whether this is important I suggest you consider `git describe`. – Magnus Bäck Jan 28 '14 at 20:21
  • possible duplicate of [Is there a single Git command to get the current tag, branch and commit?](http://stackoverflow.com/questions/2863756/is-there-a-single-git-command-to-get-the-current-tag-branch-and-commit) – First Zero Jan 29 '14 at 02:47

1 Answers1

0

I suggest you create a shell script, run git count in that script and pass the resulting variable to maven, e.g.

#!/bin/sh

GIT_COUNT=$( git rev-list HEAD --count )

mvn install "-Dgit-count=${GIT_COUNT}"
Alexander Pogrebnyak
  • 44,836
  • 10
  • 105
  • 121