Here is a script to add a git hash to your app Info.plist when building. The script can also add the git status (clean or not). It does not require preprocessing of the Info.plist, extra targets, or temporary files that must be ignored by git. The script works by modifying the Info.plist in the finished build, so it does not disturb the project working directory and your clean git state.
Open up the Info.plist file and add two properties with keys GitShaHash, and GitState. These values will be overwritten during the build process. I have seen similar scripts that work by storing the hash in CFBundleVersion instead. However, OS X uses CFBundleVersion to compare versions of the same app, and the Mac App Store also requires updates to have a sequential CFBundleVersion. Since the git hash is not sequential, it's better to just leave CFBundleVersion alone and relegate it to an under the hood value.
All done, now the values will be generated every time you build and the values can be accessed easily from the Info.plist using code:
It’s a good idea to place the values within the about panel or a similar location. The hash can make it easier to track issues with beta testers. And the git state makes it easier to prevent dirty builds from being distributed.