1

I use git to share config files between several computers. So I've set up a small script that does a bunch of git pull / git push each time one of these computers is started or halted.

The problem is that I don't always take the time to read the output of these scripts, and so I could miss some merging conflicts warnings.

Is there a way to make git send me an email each time a git pull from a repository leads to unresolved conflicts ?

1 Answer 1

2

Modify the example hook (in .git/hooks/prepare-commit-msg.sample (the first one, that uncomments "Conflict" messages)) to find conflict messages and send them in email.

http://git-scm.com/docs/githooks

3
  • If I understand correctly, this hook is only called by git commit, and the code in the example is run if this commit is a merge and it is succesful. But what I would like is a hook that would be run in case a git pull leads to unresolved conflicts...
    – juba
    Apr 15, 2011 at 10:17
  • 1
    Rereading, I think you're right. There may not be a hook run on unsuccessful pulls. Why not look at the exit status of git pull, in that case?
    – user227667
    Apr 15, 2011 at 11:23
  • Yes, you're right, I think I'll use something like : git pull 2> /tmp/git_pull_output.txt; if [ $? != 0 ]; then mail -s "Git pull failed" foo@example.com < /tmp/git_pull_output.txt; fi
    – juba
    Apr 15, 2011 at 12:23

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.