Skip to content

Instantly share code, notes, and snippets.

@shnarazk
Last active May 2, 2017 23:18
Show Gist options
  • Save shnarazk/100c4f3cf58f573e204c8a1e6c58bced to your computer and use it in GitHub Desktop.
Save shnarazk/100c4f3cf58f573e204c8a1e6c58bced to your computer and use it in GitHub Desktop.
#!/bin/sh
# this should be as GIT/hooks/{post-commit,post-merge}
if [ -n "${GIT_DIR}" ] ;
then
TARGET=${GIT_DIR}/../commitid.tex ;
else
TARGET=commitid.tex ;
fi
git log -1 --format="format:\
\\gdef\\GITCommitHash{%H}%n\
\\gdef\\GITCommitID{%h}%n\
\\gdef\\GITAuthorDate{%aI}%n\
\\gdef\\GITAuthorName{%an}%n" > ${TARGET}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment