Created
March 29, 2011 18:47
-
-
Save jcromartie/892979 to your computer and use it in GitHub Desktop.
Git command to list merged (or unmerged with -u) branches
This file contains hidden or 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/ruby | |
show_unmerged = ARGV[0] == '-u' | |
branches = `git branch -r`.split("\n") | |
branches.each do |branch| | |
is_merged = `git branch --contains #{branch}` =~ /master/ | |
puts branch if show_unmerged ^ is_merged | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment