Created
August 3, 2012 09:17
-
-
Save hSATAC/3246217 to your computer and use it in GitHub Desktop.
Check git branch been merged or not
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
| #!/usr/bin/env ruby | |
| require 'rubygems' | |
| require 'active_support' | |
| merged = `cd /home/m/git/repositories/miiicasa.git && git branch --merged master | grep -v master` | |
| not_merged_cmd = 'cd /home/m/git/repositories/miiicasa.git && git branch | grep -v master | grep -v support | grep -v qa' | |
| for line in merged.split("\n") | |
| not_merged_cmd += '| grep -v ' + line | |
| end | |
| puts "This is a regular check of miiiCasa.git branches\n" | |
| puts "List below are branches already been merged into [master]:" | |
| puts "Please check if they are still needed, grb delete them otherwise.\n" | |
| puts merged | |
| puts "\n--------------------\n\n" | |
| puts 'List below are branches order than 1 month and have NOT been merged into [master]:' | |
| puts "Please check if they are abandoned or forgotten." | |
| not_merged = `#{not_merged_cmd}` | |
| for line in not_merged | |
| date = /\S+_([0-9]+)_/.match(line)[1] | |
| puts line if 1.month.ago > Date.parse(date) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment