Everytime i commit changes using git bash, i want mvn verify to get executed before a git push. I always forget that and then pipeline gets failed. Any suggestions/plugins on IntelliJ is also welcomed.
Asked
Active
Viewed 879 times
1 Answers
3
You haven't specified anything about github, so I assume plain git here.
With this in mind there are a couple of ways you can try:
Instead of using
git push
make yourself accustomed to use a script that you'll write (put it in an alias or something). Likealias gp = <run maven> <check result> <if ok> -> push, otherwise <fail>
Another way is using a pre-push git hook (available since 1.8.2) With this approach, you'll create a scipt in your git repository and it will execute when you do
git push
right before it actually sends the data to the server. The hook implementation will basically do the same thing as I've described in item 1.
See This closely related SO thread.

Mark Bramnik
- 39,963
- 4
- 57
- 97