Created
May 1, 2012 16:08
-
-
Save goncalossilva/2569201 to your computer and use it in GitHub Desktop.
Don't commit conflicts
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 | |
`git diff-index --name-status HEAD`.split("\n").each do | |
|status_with_filename| | |
status, filename = status_with_filename.split(/\s+/) | |
next if status == 'D' | |
File.open(filename) do |file| | |
while line = file.gets | |
if line.include?("<<<<<<<") || line.include?(">>>>>>>") | |
puts "ERROR: #{filename} has unresolved conflicts" | |
puts "Continue (type 'yes')?" | |
if gets.chomp == "yes" | |
next | |
else | |
exit(1) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment