Skip to content

Instantly share code, notes, and snippets.

@mfontani
Created November 9, 2011 11:22
Show Gist options
  • Save mfontani/1351166 to your computer and use it in GitHub Desktop.
Save mfontani/1351166 to your computer and use it in GitHub Desktop.
Which branches "change" this file, compared to the current branch?
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename qw<basename>;
my $file = shift
or die basename($0), ": need a file\n";
my @branches = map {
chomp;substr($_,2)
} qx!/usr/bin/git branch!;
for my $b (@branches) {
my @diff = qx!/usr/bin/git diff $b -- $file!;
next if !@diff;
print "***** DIFF FOR BRANCH $b *****\n";
print "@diff";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment