简体   繁体   English

如何通过外壳脚本使用git svn从SVN获取最新标签

[英]How to get latest tag from SVN using git svn through shell script

how to retrieve latest svn tag using git svn client from origin through shell script. 如何通过外壳脚本使用git svn客户端从源中检索最新的svn标签。

Basically would like to automate getting latest tag from remote SVN and sync with local git repo. 基本上想自动化从远程SVN获取最新标签并与本地git repo同步。 So I use "git svn" and would like to introduce hudson/jenkins job to perform this step. 因此,我使用“ git svn”,并想介绍hudson / jenkins工作来执行此步骤。

thanks in advance 提前致谢

Convert the svn tags to git tags and then use them as you usually. 将svn标记转换为git标记,然后照常使用它们。

# Loop on all the remote tags 
git-for-each-ref refs/remotes/origin/tags | cut -d / -f 5- | while read ref
do

# Attach the tag to the desired commit
git tag -a "$ref" -m"say farewell to SVN" "refs/remotes/origin/tags/$ref"

# remove the old reference 
git push origin ":refs/heads/tags/$ref"

# push it to your remote so your jenkins can use it
git push origin tag "$ref"

done

You can also read about it here as well: 您也可以在这里阅读有关它的信息:
https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM