I have used GIT for a year, commit and push hundreds of commits. However I still forgot our GIT naming convention and push a wrong commit last week. I wonder if there is a tool for checking the commit message before I press commit button.
Fortunately, GIT provides us many powerful hooks to do this. After two hours searching in Google, I found an awesome sample which is written by python but I prefer perl than python so I decide to write my own perl script.
Then, I copy perl.exe from my install git folder to .git/hooks
Finally, I modify the script commit-msg to call my perl script:
exec .git/hooks/perl.exe .git/hooks/check-commit-message.pl $1
Now, everytime I make a commit, the hook commit-msg will run and check my commit message
Không có nhận xét nào:
Đăng nhận xét