I am fetching git commit message from my Jenkin freestyle project by cloning the git repo, by using the below command.
git log -1 --pretty=%B ${GIT_COMMIT}
I am able to get Git commit message using this, but I want to fetch only the specific message from that commit line . For example: [pqr9022827] ABAP Unit -> is the commit message I am obtaining, I need to know how to obtain only those string within the square brackets i.e., pqr9022827 and store it in some environment variable