Skip to content

Instantly share code, notes, and snippets.

@tangoabcdelta
Last active January 12, 2021 17:04
Show Gist options
  • Save tangoabcdelta/caedd6dcaf04d1bfe8b79fb2634f8bf3 to your computer and use it in GitHub Desktop.
Save tangoabcdelta/caedd6dcaf04d1bfe8b79fb2634f8bf3 to your computer and use it in GitHub Desktop.
Get all git commits since last tag
TL;DR
# step 1: get all git commits since last tag
git log $(git describe --tags --abbrev=0)..HEAD --oneline`

# step 2: copy the output and paste in the message
git tag -a v1.0.2 -m "...paste here..."

or, do it in a single shot

git log $(git describe --tags --abbrev=0)..HEAD --oneline | xargs -I {} git tag -a v1.0.2 -m {}

caution: this command attempts to annotate multiple times, hence problematic, but it works.

1. Get all git commits since last tag
# Get all git commits since last tag
git log <yourlasttag>..HEAD
git log <yourlasttag>..HEAD --oneline
git log $(git describe --tags --abbrev=0)..HEAD --oneline`
git log --oneline $(git describe --tags --abbrev=0 @^)..@
git log --all --oneline
2. Get all commits since the last tag and add them as the tagging annotation message
# get all commits since the last tag and add them
# as the tagging annotation message
git log $(git describe --tags --abbrev=0)..HEAD --oneline | xargs -I {} git tag -a v1.0.2 -m {}
2.a. aforementioned command is a short-hand for the following 2
# aforementioned command is a short-hand for the following 2
git log $(git describe --tags --abbrev=0)..HEAD --oneline
git tag -a v1.0.1 -m <get the output from the previous command>
2.b. Want to list all commits since the last subversion tag?
# list all commits since the last subversion tag?
svn log URL/tags --limit 1
svn log -r X:HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment