Last active
July 30, 2019 11:31
-
-
Save gpr/18b609ec3d823ea3377890ffa4c6dff1 to your computer and use it in GitHub Desktop.
[Show commits that contain a reference to a Jira issue] #jira #git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# usage: git-log-show-jira-commit.bash <JIRA_KEY> | |
# | |
JIRA_KEY=${1:?} | |
REGEX="^.*(${JIRA_KEY}-\d+).*\$" | |
git log -P --grep="${REGEX}" --pretty=%H | while read line | |
do | |
p=$(git log -1 $line --pretty=%B | perl -ne "/${REGEX}/ and print \"\$1 \"") | |
git log -1 $line --pretty="$p: %h %s" | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment