- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
github cloners: please update your tags
Thu, 2011-12-08, 19:42
So today's important lesson about git is that tags move around like a
virus and as long as anyone has a particular tag it is liable to keep
coming back from the dead. Apparently a mass vaccination effort is
required to eliminate them. On top of that, it is rocket science to
mass delete remote tags. So if you did something incredibly unwise
like renaming a bunch of tags, you will never be allowed to forget
about it.
Here's a script I wrote to delete all the tags off a remote.
**** IF YOU HAVE A SCALA CLONE ON GITHUB I NEED YOU TO RUN THIS ****
You can get back the correct tags after clearing all yours out with
something like
git fetch scala --tags
Where scala is whatever name you have for the remote at
https://github.com/scala/scala .
#!/usr/bin/env bash
#
# Deletes all tags off a git remote
# e.g. git-rm-remote-tags origin
[[ $# -eq 1 ]] || { echo "Usage: $0 "; exit 0; }
tagrefs () {
git ls-remote $remote | awk '{ print $2 }' | grep ^refs/tags/ | grep -v \{\}$
}
runner () {
echo Running: "$@"
"$@"
}
runner git push $remote $(
for ref in $(tagrefs); do
echo :$ref
done
)
Thu, 2011-12-08, 20:11
#2
Re: github cloners: please update your tags
Oh, these non-typesafe languages.
Here's another attempt. Deletes all local tags too. If you've really
deleted all the tags, this url:
https://github.com//scala/tags
Will say there are no tags.
#!/usr/bin/env bash
#
# Deletes all local tags and all tags off a remote
# e.g. git-rm-remote-tags origin
[[ $# -eq 1 ]] || { echo "Usage: $0 "; exit 0; }
remote="$1"
tagrefs () {
git 2>/dev/null ls-remote --tags $remote | awk '{ print $2 }' | grep -v \{\}$
}
runner () {
echo % "$@"
"$@"
}
runner git tag -d $(git tag -l)
runner git push $remote $(
for ref in $(tagrefs); do
echo :$ref
done
)
Fri, 2011-12-09, 17:51
#3
Re: github cloners: please update your tags
On Thu, Dec 8, 2011 at 7:58 PM, Paul Phillips <paulp@improving.org> wrote:
Oh, these non-typesafe languages.
Here's another attempt. Deletes all local tags too. If you've really
deleted all the tags, this url:
https://github.com/<githubuser>/scala/tags
Will say there are no tags.
#!/usr/bin/env bash
#
# Deletes all local tags and all tags off a remote
# e.g. git-rm-remote-tags origin
[[ $# -eq 1 ]] || { echo "Usage: $0 <remote>"; exit 0; }
remote="$1"
tagrefs () {
git 2>/dev/null ls-remote --tags $remote | awk '{ print $2 }' | grep -v \{\}$
}
runner () {
echo % "$@"
"$@"
}
runner git tag -d $(git tag -l)
runner git push $remote $(
for ref in $(tagrefs); do
echo :$ref
done
)
The following script seemed to do the right job for me:
#!/usr/bin/env bash
[[ $# -eq 1 ]] || { echo "Usage: $0 <scala/scala remote name>"; exit 0; }
for a in $(git tag -l)do echo Deleting tag $a... git tag -d $a refs=$refs" :refs/tags/$a"done
git push origin $refsgit fetch $1 --tags git push origin --tags
and you use it like:
vlad@lampmac16:~/workspace/dev/scala$ git remote -vorigin git@github.com:VladUreche/scala.git (fetch) origin git@github.com:VladUreche/scala.git (push)scalascalaremote https://github.com/scala/scala.git (fetch) scalascalaremote https://github.com/scala/scala.git (push)
vlad@lampmac16:~/workspace/dev/scala$ ./git-rm-tags scalascalaremote
HTH
Vlad
That was supposed to be
runner git push $0 $(
Or else there was something missing. I'm not sure what steps I should
have done and in which order, nor how do I verify if I'm now ok or
not.
On Thu, Dec 8, 2011 at 16:42, Paul Phillips wrote:
> So today's important lesson about git is that tags move around like a
> virus and as long as anyone has a particular tag it is liable to keep
> coming back from the dead. Apparently a mass vaccination effort is
> required to eliminate them. On top of that, it is rocket science to
> mass delete remote tags. So if you did something incredibly unwise
> like renaming a bunch of tags, you will never be allowed to forget
> about it.
>
> Here's a script I wrote to delete all the tags off a remote.
>
> **** IF YOU HAVE A SCALA CLONE ON GITHUB I NEED YOU TO RUN THIS ****
>
> You can get back the correct tags after clearing all yours out with
> something like
>
> git fetch scala --tags
>
> Where scala is whatever name you have for the remote at
> https://github.com/scala/scala .
>
>
> #!/usr/bin/env bash
> #
> # Deletes all tags off a git remote
> # e.g. git-rm-remote-tags origin
>
> [[ $# -eq 1 ]] || { echo "Usage: $0 "; exit 0; }
>
> tagrefs () {
> git ls-remote $remote | awk '{ print $2 }' | grep ^refs/tags/ | grep -v \{\}$
> }
> runner () {
> echo Running: "$@"
> "$@"
> }
>
> runner git push $remote $(
> for ref in $(tagrefs); do
> echo :$ref
> done
> )