Created
August 13, 2024 13:04
-
-
Save turbq/f538d17adf77a831c2c84e8d238f877b to your computer and use it in GitHub Desktop.
Get commit hash for using in atmel studio (visual studio probably) pre-build event.
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
| rem to use as a command make precentage signs single | |
| git log -n 1 --pretty=format:^ | |
| "^ | |
| #ifndef GIT_COMMIT_H%%n^ | |
| #define GIT_COMMIT_H%%n^ | |
| %%n^ | |
| static const char* GIT_INFO = \"[%%H, %%d]\r\n\";%%n^ | |
| %%n^ | |
| #endif%%n^ | |
| " > ..\src\gitcommit.h |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CMD one-liner
git log -n 1 --pretty=format:"#define GIT_INFO%nstatic const char* GIT_INFO = "[%H, %d]\r\n";" > output.txt
Powershell one-liner
git log -n 1 --pretty=format:'#define GIT_INFO%nstatic const char* GIT_INFO = "[%H, %d]\r\n";' > output.txt