Skip to content

Instantly share code, notes, and snippets.

@buddhamagnet
Created June 8, 2012 18:36
Show Gist options
  • Save buddhamagnet/2897487 to your computer and use it in GitHub Desktop.
Save buddhamagnet/2897487 to your computer and use it in GitHub Desktop.
GIT: HOOKS: PRECOMMIT
#!/usr/bin/env ruby
if `egrep -rls "^<<<<<<< |^>>>>>>> |^=======$" * | xargs file | egrep 'script|text'` != ""
puts "Merge cruft alert!"
puts `egrep -rls "^<<<<<<< |^>>>>>>> |^=======$" * | xargs file | egrep 'script|text' | awk -F: '{print $1}'`
exit(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment