2012-02-24 4 views

답변

0

netbeans/ant가 쉘 명령을 실행할 수 있으면 가능합니다.

현재 분기의 이름을 가져 오는 방법은 How to programmatically determine the current checked out Git branch을 참조하십시오. 그러면 값을 사용할 수 있도록 빌드 스크립트에서이를 통합해야합니다.

branch_name=$(git symbolic-ref -q HEAD) 
branch_name=${branch_name##refs/heads/} 
branch_name=${branch_name:-HEAD} 

당신이를 실행하고 환경 변수로 저장하는 쉘 스크립트에 넣고 수 있으며, : 현재 브랜치 이름을 얻고 branch_name ENV 변수로 설정할 수 있습니다

4

(위 용액에 제안) ENV 변수를 처리하지 않으려면 그리고 자식 명령은 명령 줄에서 사용할 수있는 경우, 대체 솔루션은 ANT 간부를 사용하는 것입니다 : 내가 트래비스 CI에이 시도

<exec executable="git" outputproperty="git.branch" 
failifexecutionfails="false"> 
<arg line="rev-parse --abbrev-ref HEAD"/> 
</exec> 
<echo message="Current branch: ${git.branch}"/> 

(솔루션이 기본적으로 통합 http://llbit.se/?p=1876How to get the current branch name in Git?)

+0

는, 단순히'현재 분기를 인쇄 : HEAD'를 –

관련 문제