Is there a single Git command to get the current tag, branch and commit?

command-line, git, mavanagaiata, maven

Solution

I created a Maven plugin for exactly this purpose, which really fits my needs (in fact it exceeds them by now).

It's called Mavanagaiata, it's open-source and available from Maven Central.

Problem

I'm currently using a collection of three commands to get the current tag, branch and the date and SHA1 of the most recent commit. ``` git describe --always --tag git log -1 --format="%H%n%aD" git rev-parse --abbrev-ref HEAD ``` Which will output something like: ``` 1.2.3-5-gdeadbeef deadbeef3b8d90071c24f51ac8f26ce97a72727b Wed, 19 May 2010 09:12:34 +0200 master ``` To be honest, I'm totally fine with this. But I'm using these commands from Maven and anyone who'd used Maven before, knows how much things like external commands bloat the POM. I just want to slim down my pom.xml and maybe reduce execution time a bit.

Original source

Related problems