Live data from Hacker News

Setting up pre-commit tests with Git

dduvnjak.pw

11–12 of 12 posts

Re: Setting up pre-commit tests with Git

#11

IMO we shouldn't have to jump through hoops to be able to commit. Let people commit whatever they want and then run tests to decide if you want to merge in their branches. The workflow should encourage people to commit early and often to safeguard the work they've been doing as much as possible. It's very frustrating to lose work because it wasn't in the git object store.

True, although I've used something similar that compiles the code and runs tests, if they failed it asked if I still wanted to commit. It was just a quick check that I was probably committing what I thought I was.

Re: Setting up pre-commit tests with Git

#12
post #7

At my work I setup a pre-commit hook that my team uses to run Uncrustify, a source-code beautifier. If the style of the commit doesn't match our rules for that language it will spit out a command for you to run to fix it. I think overall it has been a big win for our team. Uncrustify runs almost instantly and having a uniformly styled code-base is worth the small inconvenience.

I've been doing this from my make file every build. That way, vim will take me right to the error.
Post reply on HN