How can I include the git commit hash in Xcode?
I've written an implementation based on the answer cited by gagarwal. I added this build script to my build phases before the compilation phase:
/usr/libexec/PlistBuddy -c "Set :GIT_COMMIT_HASH `git rev-parse HEAD`" "${TARGET_BUILD_DIR}"/"${INFOPLIST_PATH}"
In my code I reference it by calling:
[[NSBundle mainBundle] infoDictionary][@"GIT_COMMIT_HASH"];
And voila, your last commit hash value is available at run-time!