I'm trying to generate some release notes using the following:
git log --pretty=format:%s my-project-1.2..HEAD
However, how can I reuse something similar to this generically after each new rev instead of specifying the last known good rev (everytime) to work from (one down from head)?
i.e
git log --pretty=format:%s [somehow get my-project-last-rev so I don't have to specify]..HEAD
In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.
In order to create a Git tag for the last commit of your current checked out branch, use the “git tag” command with the tag name and specify “HEAD” as the commit to create the tag from. Similarly, if you want your tag to be annotated, you can still use the “-a” and “-m” options to annotate your tag.
Git Log Oneline The oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
The --decorate flag makes git log display all of the references (e.g., branches, tags, etc) that point to each commit. This lets you know that the top commit is also checked out (denoted by HEAD ) and that it is also the tip of the main branch.
git describe --abbrev=0 --tags
should give you the lastest tag "under" your current branch, so you could just use back-ticks to execute it inline:
git log --pretty=format:%s `git describe --abbrev=0 --tags`..HEAD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With