
Now we can take this command an execute it in our git log command by simply replacing the hard coded tag as follows: git log $(git describe -tags -abbrev=0).HEAD -pretty=format:"%s" | grep -i -E "^(\|\|\|\)*\"ġ1. So with the command from above we can simply get the latest tag. Instead, we could achieve a robust script using git describe: git describe -tags -abbrev=0
GITHUB SEE COMMIT HISTORY CODE
Now if the latest version is 1.56.1 then we would have to change the code to get the same result because the version is hard coded in our little command/script. Let’s say the latest tag/version is 1.56.0, then we could get the features since that version as follows: git log 1.56.0.HEAD -pretty=format:"%s" | grep -i -E "^(\|\|\|\)*\" Listing commits since a given tag without using a hard coded tag We don’t actually wanna see the commit hash in the output, and leaving it out makes the regex look better: git log -pretty=format:"%s" 1.44.16.HEAD | grep -i -E "^(\|\|\|\)*\"ġ0. Improving the output format for a nicer regex Well, it works so far, but we’re not satisfied…ĩ. Note the that the regex of grep ignores the case and finds even in case there are multiple annotations available. Just to mention it: if you only want the count you could use –pretty=oneline: git log -pretty=oneline 1.44.16.HEAD | wc -l
GITHUB SEE COMMIT HISTORY UPGRADE
The total amount of commits since 1.44.16 is 17.519! What version do your customers use again? Maybe you can convince them with a few numbers to upgrade 😉 Lots of changes, lots of feature, lots of bugfixes… Additionally, we want only to see the commits made since version (=tag) 1.44.16 until now: Next, let’s change the output format a little.

Showing commits since a given tag/version until now Hint: if you only want the count you might prefer using git rev-list: git rev-list master -countħ. Well, that shows we have 38.720 commits, while 350 of them where made in the last 2 weeks. Git log -pretty=format:"%h - %an, %ar : %s" -since=2.weeks | wc -l Git log -pretty=format:"%h - %an, %ar : %s" | wc -l Then how can I prove you that the number of commits really differ? maybe counting counting: The screenshot for only 2 weeks will be the same as for previous command because the visible 8 lines in the screenshot are just the same. Let’s only get the items from the last 2 weeks: git log -pretty=format:"%h - %an, %ar : %s" -since=2.weeks The problem with the last command is that it returns pretty much everything. We could even format the output in a way that we it to be: git log -pretty=format:"%h - %an, %ar : %s" Let’s improve this: git log -pretty=oneline

Formatting the commit logs to “one-liners”Ĭool, but there’s too much distractive information. Using git log in your CLI allows you to see commit messages: git logĤ. Just clone the repo and change into the created folder: git clone I’m aware that they use annotations for their commit messages. Clone a git repo that uses annotations in commit messagesįor this demo I use the publicly available OpenUI5 JavaScript library. What a coincidence that OpenUI5 uses such annotations 🙂Ģ. When we talk about release notes we might want to list only features added since the last release something we also want to generate from the commit messages. you could generate json files containing the features – maybe to display these features inside the help menu of your web application 😉 For simplicity we’ll just create a simple list.

In more advanced scenarios you could also generate files of a certain format, i.e. Git commit -m “ my documentation change”īased on the annotations above, it’s quite easy to generate a simple list that contains for example all features, or all features and bug fixes etc.

Let’s assume you have agreed in your project to prefix git commit messages with one or more of certain prefixes (not necessarily for all changes/commits): We’re going to use simple commands instead of using one of the many tools available… And keep in mind that there are many options available even when using git commands, the ones listed here are just some of the options you have… 1. We’ll simply use the public OpenUI5 repo on GitHub, but it works with any other git repo as well (using corresponding git commit messages). To follow this blog make sure you have installed git. This blog works for anyone who uses git in combination with annotations in the git commit messages. In fact, what you will read can be easily used to create/generate release notes for your apps (i.e. Just a few hours ago I promised Wouter Lemaire to write this blog: Instead of leaking new UI5 features I’ll show you how easy it is to find out new features using just a few commands. Tomorrow, em… Today in just a few hours UI5Con 2018 St.
