Add this snipper to your theme's single.html
file:
{{ if $.GitInfo }}
<!-- To enable this, put "enableGitInfo = true" in your site config.toml -->
{{.Lastmod}}
{{ .GitInfo.AbbreviatedHash }}
{{ end }}
Make sure you enable GitInfo in your site configuration too. This conditional snippet will not throw compilation errors, but neither will it show anything without it.