Is there a git hook I can use for merge conflicts? After a failed git merge
, it would be great to be able to write a script that opens all files with conflicts in $EDITOR
. Unfortunately the post-merge
hook doesn't run if there are conflicts and from what I've seen in the githooks
man page, there are no other applicable hooks.
I'm wondering if I've missed something, or if there are other alternatives short of aliasing 'git merge' to a function or something like that.
Thanks, Chris
As suggested by Charles Bailey, the best way to do this is by customizing the mergetool. Using this guide, I came up with this simple way to have merge conflicts opened in my editor:
[merge]
tool = emacs
[mergetool "emacs"]
cmd = $editor \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
Since Charles Bailey never answered how I should give him credit for this, I hope this is an appropriate way to finally close this question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With