2017-11-01 21 views
0

Jenkinsから、私は最後にアプリケーションを導入するためのコミットコードを1つ取り出してみたいと思います。私は、この操作をGitクライアントプラグインでは実行したいが、シェルスクリプトでは実行しない。この操作を実行する方法はありますか?Jenkinsで古いバージョンをgitで取得する方法

例: - 私の現在の頭のバージョンが90696を指していると私の古い頭のバージョンは、あなたが1があなたのgitのよう背後にコミット取得する$BRANCHNAME~1を使用することができ、私は38495.

答えて

0

の頭のバージョンを取得したいと思います38495.でありますプラグインの分岐指定子。頭のみのためにHEAD~1

などの私のジェンキンスファイルレポにこれはHEAD~5与えられた任意の数で動作することを

git checkout feature/jenkins-pipelines~1 
Note: checking out 'feature/jenkins-pipelines~1'. 

You are in 'detached HEAD' state. You can look around, make experimental 
changes and commit them, and you can discard any commits you make in this 
state without impacting any branches by performing another checkout. 

If you want to create a new branch to retain commits you create, you may 
do so (now or later) by using -b with the checkout command again. Example: 

    git checkout -b <new-branch-name> 

HEAD is now at 7a4c357... updated jenkinsfile 

注ように頭の後ろ5つのコミットすることとなります。

関連する問題