XCode build number from git
Add this as a Run Script Phase at the end of Build Phases in your XCode project to increment your CFBundleVersion as {git commit count}.{uncommitted changes}-{gitrevid}.
When the build is made from a cleanly committed git repository the version will be N.0-XXXXXXX. Intermediary test builds will have N.D-XXXXXXX with the size of the diff from the actual committed version as minor.
Next related
GPG signed Git with XCode
For work projects I’ve been working on lately, we have adopted a strict gpg signed commits and tags only policy, so I thought I’d carry that good intention over to private projects as well. Except it turns out that the execution environment in which XCode runs git does not play well with gnupg.