Created
November 28, 2012 14:58
-
-
Save Zeex/4161802 to your computer and use it in GitHub Desktop.
Recover Git tags from commit messages
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
#!/usr/bin/env python3 | |
import subprocess | |
command = 'git log --oneline | grep "^[0-9a-f]\{1,7\} v[0-9\.]*$"' | |
output = subprocess.check_output(command, shell=True).decode('utf-8') | |
for line in output.splitlines(): | |
commit, tag = line.split() | |
subprocess.call('git tag -a %s -m %s %s' % (tag, tag, commit), shell=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment