In Git, how can I write the current commit hash to a file in the same commit
I would recommend doing something similar to what you have in mind: placing the SHA1 in an untracked file, generated as part of the build/installation/deployment process. It’s obviously easy to do (git rev-parse HEAD > filename or perhaps git describe [–tags] > filename), and it avoids doing anything crazy like ending up with a file … Read more