The ramblings of a developer
A short while ago @loghound posted a tweet about a github script to automatically integrate your git revision with XCode. I have added the file path as a variable and the short (7 character) revision number of the git repo.
echo "Determining revision information"
file=${SRCROOT}/GitVersions.h
revnum=`/usr/local/git/bin/git rev-list HEAD | /usr/bin/wc -l | sed -e s/^ *//g;s/ *$//g`
fullrevnum=`/usr/local/git/bin/git rev-parse HEAD`
shortrevnum=`/usr/local/git/bin/git rev-parse short HEAD`
# Now write the constant declaration to the file:
echo "#define kGitLocalRevision @"$revnum"" > $file
echo "#define kGitGlobalRevision @"$shortrevnum"" $file
echo "#define kGitHash @"$fullrevnum"" $file
echo "Wrote information for revision $revnum to $file"