Skip to content

Instantly share code, notes, and snippets.

@vclwei
Created August 20, 2013 15:48
Show Gist options
  • Save vclwei/6283272 to your computer and use it in GitHub Desktop.
Save vclwei/6283272 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
INFO_PLIST="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Info"
HASHVERSION=$(git --git-dir="${PROJECT_DIR}/.git" --work-tree="${PROJECT_DIR}" rev-parse --short HEAD)
defaults write $INFO_PLIST AutoHashVersion $HASHVERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment