Newest tag across all branches
newestTaggedCommit="$(git rev-list --tags --max-count=1)" tagName="$(git describe --tags "$newestTaggedCommit")" # Commits since tag git log "$(git rev-list --tags --max-count=1)"..HEAD --oneline
https://stackoverflow.com/a/7979255
git rev-list --tags seems reliable for my use case, finding the latest release tag. We release from different branches.
Newest tag on current branch
newestTagName="$(git describe --tags --abbrev=0)" # Commits since tag git log "$(git describe --tags --abbrev=0)"..HEAD --oneline
https://stackoverflow.com/a/12083016
git describe should look for the latest tag in both parent branches of a merge, if --first-parent isn't specified.
Jira issues merged since last tag
In case you, like me, came here for an overview of commits included in a release..
This script lists commits since the last (release) tag, for multiple repositories. If you added Jira keys in commit message titles, it opens a list of merged issues in Jira.
#!/bin/bash # Config jiraSearchUrl='https://jira.my.org/issues/?jql=' jiraProjectKey='MYAPP' localRepoDirs=( '/c/coding on windows/frontend' '../../projects/full stack app/'* ) for repo in "${localRepoDirs[@]}"; do echo; echo; echo '**** To ************************ from ****' pushd "$repo" || exit newestTaggedCommit="$(git rev-list --tags --max-count=1)" lastTag="$(git describe --tags "$newestTaggedCommit")" # Or get newest tag only from checked out branch: # lastTag=$(git describe --tags --abbrev=0) # Or enter a tag (and e.g. checkout the next tag for an overview of that release): # lastTag='my-app-9.0.0.0' echo; echo "- Commits on current branch, not yet included in $lastTag :" commits=$(git log "$lastTag"..HEAD --oneline) echo "$commits"; echo echo "- Jira keys in commit message titles, since tag $lastTag :" readarray -t jiras < <(echo "$commits" | grep -E --only-matching "$jiraProjectKey-[0-9]+" | sort -u) echo "${jiras[@]}"; echo allJiras+=( "${jiras[@]}" ) popd || exit done jqlFilter="$(IFS=, ; echo "key in (${allJiras[*]})")" filterUrl="$jiraSearchUrl""$jqlFilter" echo; echo; echo '************************************************' echo 'All merged Jira issues:' echo "$filterUrl" echo '************************************************'; echo # Open in Windows default browser start "" "$filterUrl"