Skip to content

Instantly share code, notes, and snippets.

@vhbit
Created May 6, 2011 07:50
Show Gist options
  • Save vhbit/958578 to your computer and use it in GitHub Desktop.
Save vhbit/958578 to your computer and use it in GitHub Desktop.
Git versioning for iOS project sample
version=`git describe --long`
commit=`echo $version | sed 's#.*g\([a-z0-9]\{7\}\)#\1#'`
version=`echo $version | sed 's#[a-zA-Z]*##'`
versionNum=`echo $version | sed 's#\-[0-9]*\-[a-zA-Z0-9]*##'`
echo "#define BUILD_VERSION $version" > InfoPlist.h
echo "#define PRODUCT_VERSION $versionNum" >> InfoPlist.h
echo "#define GIT_COMMIT $commit" >> InfoPlist.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment