2017-05-30 69 views
0

我做了一些svn git遷移。我所有的標籤現在看起來都很奇怪:如何通過git標籤循環

[email protected] 
[email protected] 
[email protected] 
[email protected] 

但標籤是正確的。只有名字是錯的。現在我想重命名標籤。

所以對每個標記我想做的事:

git tag new old 
git tag -d old 
git push origin :refs/tags/old 
git push --tags 

我想這個腳本。但我已經堅持要找到正確的方式來遍歷我的所有標籤。

我怎麼有循環:for every tag do ......

回答

1

怎麼樣一個for環路與git tag輸出?

for crt_tag in $(git tag) 
do 
    # if you want to suppress @... part 
    git tag ${crt_tag%@*} $crt_tag 
    git tag -d $crt_tag 
    git push origin :refs/tags/$crt_tag 
    git push --tags 
done