Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
git hash hook c
FILE="$( cd "${GIT_DIR}" && cd .. && pwd )/.gitversion.h"
echo '#ifndef GIT_VERSION' > "${FILE}"
echo -n '#define GIT_VERSION "' >> "${FILE}"
git rev-parse HEAD | tr -d '\n' >> "${FILE}"
echo '"' >> "${FILE}"
echo '#endif' >> "${FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment