You may want to try a pre-commit hook [1]. I don't think JGit supports them though.

[1] https://gist.github.com/johnjohndoe/4024222 (I haven't tested this one but it looks like it would work)