Question

I've setup a build process using Gruntjs, but don't want anyone to be able to store the output (all contained in a build/ directory) in source control. Don't Repeat Yourself n such.

I've currently got a pre-commit hook setup that cleans the build/ directory and fails the commit if there are any unstaged files (I also stash then unstash so intentionally unstaged files won't interfere with this check).

It would be more user friendly to fail at the point a build file is added: git add build/.... But I can't seem to find an example commit hook for git add. I looked at http://git-scm.com/book/ch7-3.html and http://githooks.com/.

Is this possible? If not, can you think of an improvement over my current setup?

Était-ce utile?

La solution

One of those moments where the answer comes to you as you're typing it out.

I can simply setup my .gitignore to forget build/, then also use the clean in the precommit hook to double check that no build files were added.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top