Skip to content

Instantly share code, notes, and snippets.

@edwardean
Forked from trawor/git_version.sh
Created January 4, 2017 06:37
Show Gist options
  • Save edwardean/0b390076c2fb5d113698ec94dd06d2ef to your computer and use it in GitHub Desktop.
Save edwardean/0b390076c2fb5d113698ec94dd06d2ef to your computer and use it in GitHub Desktop.
每次编译把Git的提交次数作为小版本号
#Git 版本数
VERSION_NUMBER=`git rev-list head | sort | wc -l | awk '{print $1}'`
#VERSION_HASH=`git rev-list head | head -1`
echo $VERSION_NUMBER
#echo $VERSION_HASH
##加入版本号
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${VERSION_NUMBER}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment