Skip to content

Instantly share code, notes, and snippets.

@njpearman
Created February 11, 2020 12:56
Show Gist options
  • Save njpearman/8e7487b794eba159751a5e3319eb19d0 to your computer and use it in GitHub Desktop.
Save njpearman/8e7487b794eba159751a5e3319eb19d0 to your computer and use it in GitHub Desktop.
Regenerate all tags with date set to that of the commit that was tagged
#!/bin/bash
# This script will regenerate every tag in a repository, setting the
# creation date of the tag to that of the commit that the tag is
# attached to. The message for the tag is set to the static string
# 'End of unit'.
git tag | while read tag;
do
git checkout ${tag}
git tag -d ${tag}
git push origin :refs/tags/${tag}
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag -m 'End of unit' ${tag}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment