git hooks - regenerate a file and add it to each commit ?
Posted
by
egarcia
on Stack Overflow
See other posts from Stack Overflow
or by egarcia
Published on 2010-12-25T23:49:08Z
Indexed on
2010/12/25
23:54 UTC
Read the original article
Hit count: 324
I'd like to automatically generate a file and add it to a commit if it has changed. Is it possible, if so, what hooks should I use?
Context: I'm programming a CSS library. It has several CSS files, and at the end I want to produce a compacted and minimized version. Right now my workflow is:
- Modify the css files
x.css
andy.css
git add x.css y.css
- Execute
minimize.sh
which parses all the css files on my lib, minimizes them and produces amin.css
file git add min.css
git commit -m 'modified x and y doing foo and bar'
I would like to have steps 3 and 4 done automatically via a git hook. Is that possible?
I've never used git hooks before. After reading the man page, I think I need to use the @pre-commit@ hook. But can I invoke git add min.css
, or will I break the internet?
© Stack Overflow or respective owner