2014-01-28 3 views
0

태그의 내용처럼 일부 쉘 명령어 (git rev-list HEAD --count)를 실행하고 싶습니다. 이런 식으로 뭔가 :Maven. 일부 쉘 명령어 실행 결과 얻기

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

그렇게 할 수있는 방법이 있나요?

+0

'git rev-list HEAD --count'가 명확하게 커밋을 식별하지 않는다는 것을 알고 계십니까? 이것이 중요한지에 관계없이 나는 당신이'자식 묘사 (git describe) '를 고려할 것을 제안한다. –

+0

[현재 태그, 분기 및 커밋을 가져 오는 단일 Git 명령이 있습니까?] (http://stackoverflow.com/questions/2863756/is-there-a-single-git-command-to-get -the-current-tag-branch-and-commit) –

답변

0

쉘 스크립트를 만들고 스크립트에서 git count를 실행하고 결과 변수를 maven에 전달하는 것이 좋습니다.

#!/bin/sh 

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

mvn install "-Dgit-count=${GIT_COUNT}"