githash: Compile git revision info into Haskell projects

[ bsd3, development, library ] [ Propose Tags ]

Please see the README and documentation at

[Skip to Readme]
Versions [RSS] [faq],,,,,,,,,,,,
Change log
Dependencies base (>=4.9.1 && <5), bytestring, directory, filepath, process, template-haskell, th-compat [details]
License BSD-3-Clause
Author Michael Snoyman, Adam C. Foltzer
Category Development
Home page
Bug tracker
Source repo head: git clone
Uploaded by MichaelSnoyman at 2021-09-19T05:29:22Z
Distributions Arch:, Fedora:, LTSHaskell:, NixOS:, Stackage:, openSUSE:
Downloads 12845 total (620 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-09-19 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees


Readme for githash-

[back to package description]


Build Status

Some handy Template Haskell splices for including the current git hash and branch in the code of your project. Useful for including in panic messages, --version output, or diagnostic info for more informative bug reports.

Most of the complication in the GitHash module is due to the various places the current git hash might be stored:

  1. Detached HEAD: the hash is in .git/HEAD
  2. On a branch or tag: the hash is in a file pointed to by .git/HEAD in a location like .git/refs/heads
  3. On a branch or tag but in a repository with packed refs: the hash is in .git/packed-refs

These situations all arise under normal development workflows, but there might be further scenarios that cause problems. Let me know if you run into them!