Welcome to scala-gitrev! Inspired by the gitrev haskell library, scala-gitrev provides simple macros to capture git information at compile time. This will empower you to bundle compile-time git-info with your artifacts, which can be extremely useful for debugging.

To use scala-gitrev in your scala project with SBT, simply add the following line to your build.sbt file:

libraryDependencies += "ca.aaronlevin" %% "scala-gitrev" % "0.1.1"

Example usage:

object MyCoolProject {

  import ca.aaronlevin.gitrev.gitHash

  val theGitHash: String = gitHash

  // ... other super cool code ...

  def main(args: Array[String]): Unit = {

    println(s"This artifact was compiled at revision $theGitHash")

    // ... do super cool stuff ...

Contribution policy

Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.


This code is open source software licensed under the Apache 2.0 license.