In one of our Slack channels at Contentful I recently read a few messages by Anthony who's one of our infrastructure developers. He was mentioning the git command
describe which I haven't used before.
From the official documentation this is what it does:
Describe a commit using the most recent tag reachable from it
Okay, but what does that mean? I opened my terminal and started playing around with it in one of my projects.
~/Projects/forrest | 🐺 🕊 🐱 master (╯°□°)╯ > git describe v1.0.0-zeta
As the last commit was tagged there is no surprise by executing it in there. So I checked out a previous commit and ran it again.
~/Projects/forrest | 🐳 🐟 🐘 46b7ebb ヾ(⌐■_■)ノ > git describe v1.0.0-epsilon-2-g46b7ebb
v1.0.0-epsilon is the next recent tag. Cool! The tag name is then followed by the number of commits on top of the tag and the commit hash of the current commit prefixed with
-g (this is used to describe that we're dealing with git here).
v1.0.0-epsilon-2-g46b7ebb | || | \___ ____/ \ \----------- commit hash most \ recent commits tag on top
Reading the documenation I also found out that you can get all the commits between two other commits by doing
git log hash1..hash2. Another thing I didn't know! 🎉
~/Projects/forrest | 😓 🐏 🐜 master ヾ(⌐■_■)ノ > git log 3bc8cdf..8973bae commit 8973bae7ec443f0a683ddd239cf3a8e9015877cb Author: Stefan Judis
Date: Thu Aug 18 00:47:43 2016 +0200 keep session history clean by space prefix - fix #68 (#73) commit fc7ac34f9c59343c58e6a954e0add30bff6a3d8a Author: Greenkeeper Date: Thu Aug 18 00:24:23 2016 +0200 chore(package): update dependencies (#61) https://greenkeeper.io/ commit fad11bd51d0c13dd7ca09084ddfe9b55fe8a90f1 Author: Stefan Judis Date: Thu Aug 18 00:14:37 2016 +0200 only build on node v6 - fix #71 (#72)
describe has a lot of options to configure the search for tags more granular. You should definitely have a look if you're looking up tags constantly.
And that's it for today. ;)