Pre-commit hook in IntelliJ IDEA

Answered

 

I wanted to create a pre-commit hook in IntelliJ IDEA(Community Edition) to be used to create a list of all the files selected for the commit and dump it into an xml file. I am using a Team services VCS Git repository.

I have installed the Pre-Commit plugin as well. I am not sure what code goes into the "pre-commit-hook.sh" file to be able to achieve this. Can someone help me with this?

Or is there any other better option?

0
4 comments

It's really not IDE specific, please see https://github.com/miohtama/vvv/blob/master/vvv/hooks/git.py for the sample hook. You can modify it to generate the XML from the array of files after line 156.

Google for git pre-commit hook list of files to get more help.

0
Avatar
Permanently deleted user

Thanks Serge. Let me give it a try.

0
Avatar
Permanently deleted user

Serge, i copy pasted the code from the above link as is(to start with) in the 'pre-commit-hook.sh' file to check if it works. 

I am getting the below error from the pre-commit plug-in.

https://www.screencast.com/t/hXSmacvww

Is there anything else that i need to do? Sorry if i am being silly. I am very very new to python scripts.

 

0

Please sign in to leave a comment.