pre-commit hook in git

I have been using git as my version control system since beginning with pyherc. I haven’t been using anything really advanced features. Most complex things I have been doing are having couple branches and few merges.

Recently I started thinking that I could try out using pre-commit hook for something useful and created quick and dirty script:

exit $code

Now, everytime I commit code into my local repository, unit tests are run automatically and commit is aborted if they don’t pass. This is ok for now, since tests take only couple of seconds to run, but I wouldn’t want to use this with test suite that takes 10 seconds.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s