Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Git, how do I configure a hook to run a server-side commands after a commit is accepted?

I'm trying to figure out my way with the Django localistion stuff and from what i've understood, the makemessages command needs to be run every time you change some strings in code. I was thinking of simplifying this process by using a server-side Git hook.

I have no knowledge about Git hooks and couldn't find any resources on the web that did something like this. Is there a reason why one shouldn't have a Git hook to do something like this? If not, could you explain on how I could get the makemessages command to be run every time someone commits code to the repository?

Thanks

like image 500
Mridang Agarwalla Avatar asked Nov 02 '11 12:11

Mridang Agarwalla


1 Answers

Sure thing!

Add a script called post-receive to the server side git repository in the .git/hooks/ directory.

Make sure that the file is executable.

Call makemessages from the script.

Done! (I think...)

You'll find some example scripts in the directory already, with most available hooks.

Have a look at the online Pro Git book if you need more information on Git hooks.

like image 69
brice Avatar answered Sep 22 '22 19:09

brice