In Git, how do I configure the hook to run server commands after accepting a commit?

I am trying to figure out my way with the Django localistion stuff and from what I understand, the command makemessagesshould be run every time you change some lines in the code. I was thinking about simplifying this process using a server-side Git hook.

I do not know about Git hooks and could not find any resources on the Internet that did something like this. Is there a reason why you don't need to have a git hook to do something like this? If not, could you explain how I can get the command makemessagesto run every time someone compiles the code into the repository?

thank

+5
source share
1 answer

Sure thing!

Add a script named post-receiveto the server-side git repository in the directory .git/hooks/.

Make sure the file is executable.

Call makemessages from the script.

Done! (I think...)

You will find some sample scripts in the catalog already with most of the hooks available.

Check out the online version of Pro git for more information on git hooks.

+10
source

All Articles