Created
June 27, 2012 01:10
Revisions
-
joshuaflanagan created this gist
Jun 27, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ # I used this to monitor changes to the .git folder during # my Austin on Rails lightning talk on Understanding Git. # # I ignore any changes to the .git/logs folder, because they are # noisy and don't add a lot to understanding. # If you want "the whole truth", remove the :ignore parameter below. # # ruby listen.rb <path to .git folder> # # gem install listen # its the foundation of Guard require 'listen' path_to_watch = ARGV[0] || '.' last_change = Time.now Listen.to(path_to_watch, :relative_paths => true, :ignore => /logs\//) do |modified, added, removed| # cheap way to add some separation between output from git commands latest = Time.now if (latest - last_change > 1) last_change = latest puts "\n\n" end modified.each{|m| puts "\e[33mCHANGED\e[0m #{m}" } added.each{|m| puts "\e[32m ADDED\e[0m #{m}" } removed.each{|m| puts "\e[31mREMOVED\e[0m #{m}" } end