there’s tons of recipes out there how to do this – nevertheless I want to add another one:

- create a new build phase (here named „Git Sha -> Info.plist“)
paste
# write git version SHA into Info.plist # # inspired by # - http://kswizz.com/post/2686511526/git-xcode-versioning # - http://stackoverflow.com/a/12658311 cd "$PROJECT_DIR" # say hello /usr/libexec/PlistBuddy -c "Set :CFBundleVersionGitSHA $(git rev-parse --short HEAD)" "$TARGET_BUILD_DIR/$INFOPLIST_PATH"
add key
CFBundleVersionGitSHA
with placeholder text to your Info.plist
I went for this one because
- easy setup,
- no build/compiler settings changes,
- doesn’t interfere with ‘normal’ versioning,
- simplest I’ve seen so far, no dependencies except git,
- explicit failure if e.g. git is missing.
Credits: