Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created August 5, 2009 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dagolden/162480 to your computer and use it in GitHub Desktop.
Save dagolden/162480 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use File::Slurp 'read_file';
my ($commitlist, $taglist) = @ARGV;
die "usage: $0 <commit-list> <tag-list>\n"
unless -f $commitlist && -f $taglist;
my @commits = map { chomp; $_ } read_file($commitlist);
my %tags = map { chomp; $_ => 1 } read_file($taglist);
COMMIT:
for my $c ( @commits ) {
for my $t ( reverse sort keys %tags ) {
system "git diff --quiet -b $c $t";
if ( $? == 0 ) {
system "git co $c";
system "git tag -d $t";
system "git tag $t";
delete $tags{$t};
next COMMIT;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment