Skip to content

Instantly share code, notes, and snippets.

@yannxou
Created February 20, 2026 07:20
Show Gist options
  • Select an option

  • Save yannxou/c21f1e434f996b5944765078feec61ea to your computer and use it in GitHub Desktop.

Select an option

Save yannxou/c21f1e434f996b5944765078feec61ea to your computer and use it in GitHub Desktop.
Use Git Commit Count as Build Number in xcode
# Add this to a target's build phases -> New run script phase
# Use Git Commit Count as Build Number
BUILD_NUMBER=$(git rev-list --count HEAD)
echo "Build number: $BUILD_NUMBER"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUILD_NUMBER" \
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment