Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

How to read latest git commit message using python?

Hi Team,

 

     We need to implement a python script to read the git commit message when the user commits with the following syntax (e.g: ABC-123: + commit message) ABC-123 is the Jira issue Id. And also we need to check Jira issue id is valid in Jira server. Could you please help on how to implement this requirement.

 

Regards,
Hemanth.

2 Replies
Commander Lvl 3
Message 2 of 3

Re: How to read latest git commit message using python?

You could use something like GitPython (https://gitpython.readthedocs.io/en/stable/intro.html)  to extract the commit message and then parse it using RegEx.


- Mark
Copilot Lvl 2
Message 3 of 3

Re: How to read latest git commit message using python?

How do we check for the Jira Id Is Valid during the git push?