Created
January 21, 2016 20:07
-
-
Save krishnagists/ef9ede40c7622421a569 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Replaces all _lightweight_ Git tags with an _annotated_ tag | |
# in the current repository | |
echo "Converting lightweight tags to annotated tags..." | |
for tag in $(git tag) | |
do | |
echo "Converting tag $tag" | |
cmt=$(git log -1 --pretty=%s $tag) | |
tagger=$(git log -1 --pretty=%an $tag) | |
tagmail=$(git log -1 --pretty=%ae $tag) | |
tagdate=$(git log -1 --pretty=%ad $tag) | |
git checkout $tag | |
git tag -d $tag | |
GIT_COMMITTER_EMAIL=$tagmail GIT_COMMITTER_DATE=$tagdate GIT_COMMITTER_NAME=$tagger git tag -a -m "$cmt" $tag | |
git push origin :refs/tags/$tag | |
git push --tags | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment