172
votes

I need to perform some actions (prepare gettext *.mo message files) on my project everytime I run git pull. Is there any suitable git hook, which I could use for this purpose please?

2
@Alan: That is definitely not a duplicate. This question is about a hook on the local side, where you run git pull. The one you linked is about triggering a hook on the remote, when someone pulls from it. (And it's a very strange question - it implies that they're using a non-bare central repo...) - Cascabel
@Alan: Easy enough to miss if you were skimming - hope I wasn't too harsh. I just get paranoid about questions getting incorrectly closed, since reopen votes take so much longer to accumulate. - Cascabel
Jefromi: You are absolutely right. No need to worry. I was just sad that I skimmed and initiated the close. - Alan Haggai Alavi

2 Answers

197
votes

The githooks man page is a complete list of hooks. If it's not on there, it doesn't exist.

That said, there is a post-merge hook, and all pulls include a merge, though not all merges are pulls. It's run after merges, and can't affect the outcome. It never gets executed if there were conflicts; you'd have to pick that up with the post-commit hook if it really matters, or invoke it manually.

19
votes

post-merge - see https://git-scm.com/docs/githooks#_post_merge for more details of how to use it.