Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Created April 23, 2015 22:51
Show Gist options
  • Save jpotts18/f72569fe11c7dfadebd7 to your computer and use it in GitHub Desktop.
Save jpotts18/f72569fe11c7dfadebd7 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
GIT_COMMIT=$(git rev-parse --verify HEAD | cut -c 1-7)
GIT_COMMIT_COUNT=$(git rev-list master | wc -l)
# GIT_TAG=$(git describe --abbrev=0)
defaults write $PRODUCT_SETTINGS_PATH GitCommit $GIT_COMMIT
defaults write $PRODUCT_SETTINGS_PATH CommitCount $GIT_COMMIT_COUNT
# defaults write $PRODUCT_SETTINGS_PATH GitTag $GIT_TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment