Forked from ThomDietrich/git-create-revisioninfo-hook.sh
Last active
July 23, 2018 21:31
-
-
Save douglasjarquin/61b6fb2a037142bae5ace44bd7bcce58 to your computer and use it in GitHub Desktop.
git hook for revision and branch version file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Automatically generate a file with git branch and revision info | |
# | |
# Example: | |
# a830382 | |
# | |
# Install: | |
# $ cp git-create-revisioninfo-hook.sh .git/hooks/post-commit | |
# $ cp git-create-revisioninfo-hook.sh .git/hooks/post-checkout | |
# $ cp git-create-revisioninfo-hook.sh .git/hooks/post-merge | |
# $ chmod +x .git/hooks/post-* | |
exec 1>&2 | |
shorthash=`git log --pretty=format:'%h' -n 1` | |
echo "$shorthash" > revision.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment