I use astyle to get my Java and C++ into a unified look. Sometimes I write something and check it into git before running astyle. So I will end up with a commit message like Run astyle which makes cherry-picking and all the like more difficult.

I tried to write a pre-commit hook, but that cannot alter what is going to be commited, it will just fix it in the next commit. I tried a filter, but that does not change the files on the disk.

Is there some neat way to get git to run something before even assessing the changed, other than writing a small script (and remember to use it)?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

It sounds like if you use both the filter (to fix the committed files) and the pre-commit hook (to fix the files on disk), it will do what you're looking for.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.