Skip to content

Instantly share code, notes, and snippets.

@r-lyeh-archived
Created October 13, 2015 10:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save r-lyeh-archived/39133b4c169387987867 to your computer and use it in GitHub Desktop.
Save r-lyeh-archived/39133b4c169387987867 to your computer and use it in GitHub Desktop.
generate git info for C++ inclusion
:: generate git info for C++ inclusion
:: - rlyeh, public domain
git rev-list --count --first-parent HEAD > git.hpp
set /p REVISION=<git.hpp
git rev-parse --abbrev-ref HEAD > git.hpp
set /p BRANCH=<git.hpp
echo #pragma once > git.hpp
echo #define GIT_BRANCH "%BRANCH%" >> git.hpp
echo #define GIT_REVISION "%REVISION%" >> git.hpp
echo #define GIT_REVISION_NUM %REVISION% >> git.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment