Last active
August 29, 2015 13:56
-
-
Save kaushikgopal/8950126 to your computer and use it in GitHub Desktop.
Git script to check changes to a file since last tagged release
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 ruby | |
require 'optparse' | |
tag_name = %x[git tag | tail -1].strip | |
optparse = OptionParser.new | |
optparse.parse! | |
filename = ARGV.pop | |
puts "\n" | |
puts "---------------------------------------\n" | |
puts "LAST RELEASE - \033[1;35m#{tag_name}\033[0m" | |
changes = %x[git ll #{tag_name}.. #{filename}] | |
num_of_changes = changes.lines.count | |
puts "#{num_of_changes} changes so far\n" | |
puts "---------------------------------------\n" | |
puts "#{changes}\n\n" if num_of_changes > 0 | |
=begin | |
# my git alias for ll | |
[alias] | |
ll = !git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
# I alias this script to gcheck. So i run the file like so: | |
$> gcheck my/git/file/in/repo/SomeActivity.java | |
--------------------------------------- | |
LAST RELEASE - android_release_X-X-X | |
1 changes so far | |
--------------------------------------- | |
* qh51d30 - fix: random fix to test git script (18 hours ago) <Kaushik Gopal> | |
=end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment