有很多在 Linux 和 Unix 中执行后将Subversion分支转换为 Git标签的示例。git svn clone
我能够使用从这篇博客文章到这一步的步骤(文章中的第 6 步)。我需要将脚本移植到 PowerShell。这是Linux版本:
git for-each-ref --format='%(refname)' refs/heads/tags |
cut -d / -f 4 |
while read ref
do
git tag "$ref" "refs/heads/tags/$ref";
git branch -D "tags/$ref";
done
以下是我目前所拥有的 PowerShell 版本:
git for-each-ref --format='%(refname)' refs/heads/tags |
# not sure how to replace "cut"
do {
git tag "$ref" "refs/heads/tags/$ref";
git branch -D "tags/$ref";
} while (<# I'm assuming I'm iterating a collection but I'm not sure what or how. should this be a foreach instead? #>)
done