Skip to content

Instantly share code, notes, and snippets.

@neonichu
Created January 31, 2013 00:07
Show Gist options
  • Select an option

  • Save neonichu/4678613 to your computer and use it in GitHub Desktop.

Select an option

Save neonichu/4678613 to your computer and use it in GitHub Desktop.
Shell script for showing differences between working copy and committed state of Xcode projects. Uses the xcodeproj commandline utitlity from the xcodeproj Gem.
#!/bin/sh
##
# Git diff for Xcode projects
#
# $ sudo gem install xcodeproj
##
if [ -z "$DIFF" ]
then
DIFF=diff
fi
if [ -z "$1" ]
then
export GIT_EXTERNAL_DIFF=$0
git diff
else
if echo "$2"|grep '.pbxproj$' >/dev/null 2>&1
then
TMP=`mktemp -d /tmp/tmp.XXXXXX` &&
cp "$2" "$TMP/project.pbxproj" &&
xcodeproj project-diff "$TMP" "`dirname "$5"`"
rm -f "$TMP/project.pbxproj"
rmdir "$TMP"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment