Created
April 5, 2020 10:34
-
-
Save tomvit/acb50ea4fb48d7706a99c2f389725e7d to your computer and use it in GitHub Desktop.
Get all commits; for each commit show a sequence number of a commit after the last tag
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
#!/bin/bash | |
# the last tag | |
tag=$(git tag | head -1) | |
# number of commits after tag | |
c=$(git rev-list $tag..HEAD | wc -l) | |
c=$((c-0)) | |
# header | |
printf '%-6s' "TAG" && printf '%-4s' "NUM" && printf "COMMIT\n" | |
# list of tags, number of commit after tag and a commit hash | |
git rev-list $tag..HEAD | \ | |
while read line; do \ | |
printf '%-6s' "$tag" && printf '%-4s' "$c" && printf "$line\n" | |
c=$((c-1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment