Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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)?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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