Configuring auto links to reference external resources is one of the most helpful features of GitHub.
Configuring it will make the commit message clickable, and it'll reference the external resource (i.e. Jira).
I thought it'd be very useful if you could do the same but from the CLI. So I wrote a simple script that does that.
You should have two variables set:
REFERENCE_PATTERN- Pattern used in commit message
TARGET_URL- Link to the external system you want to link to
For example, to link Jira issues having pattern like "PS-1425", you should set
PS-\d\d\d\d, and the
TARGET_URL should be set to
Once set, you simply run:
If only one issue is referenced in the commit message, it'll be opened in the browser. Otherwise, you'll get a list of links for the issue.
For example, having the following log:
Author: MarounMaroun <**** .com> Date: Tue Jun 30 23:16:30 2020 +0300 BD-5562: handle missing user in the user service
When you run:
A new tab with the relevant issue will be opened:
Project in GitHub: https://github.com/MarounMaroun/gitlink