Skip to content

Instantly share code, notes, and snippets.

@jisaacks
Forked from jamesdabbs/post-merge
Created February 25, 2013 14:05
Show Gist options
  • Save jisaacks/5029981 to your computer and use it in GitHub Desktop.
Save jisaacks/5029981 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Notifies you when certain files are changed which necessitate further action on your part.
#
# To enable:
# - copy this file to .git/hooks/post-merge
# - chmod +x .git/hooks/post-merge
commits = `git reflog -n 2`.lines.map { |l| l.split.first }
changed = `git diff --name-only #{commits.first} #{commits.last}`.lines.map &:strip
actions = {
'Gemfile' => 'bundle',
'db/schema.rb' => 'rake db:migrate'
}.select { |file, action| changed.include?(file) }
unless actions.empty?
puts "\n\e[33mThis merge altered your environment. You should probably"
actions.each do |file, action|
puts "\e[0m* \e[1;33m#{action}"
end
puts "\e[0;33mBe sure to restart resque if needed\e[0m "
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment