小编Kim*_*im 的帖子

Shell脚本 - 尝试验证if/else语句中git存储库中是否存在git标记

我正在为zend应用程序创建一个部署脚本.几乎只完成了脚本我想验证repo中是否存在标记以强制团队中的标记.目前我有以下代码:

# Fist update the repo to make sure all the tags are in
cd /git/repo/path
git pull

# Check if the tag exists in the rev-list. 
# If it exists output should be zero, 
# else an error will be shown which will go to the else statement.
if [ -z "'cd /git/repo/path && git rev-list $1..'" ]; then

    echo "gogo"

else

    echo "No or no correct GIT tag found"    
    exit

fi
Run Code Online (Sandbox Code Playgroud)

期待您的反馈!

更新

当我在命令行中执行以下命令时:

cd /git/repo/path && git …
Run Code Online (Sandbox Code Playgroud)

git bash shell

41
推荐指数
5
解决办法
3万
查看次数

标签 统计

bash ×1

git ×1

shell ×1