Skip to content

Instantly share code, notes, and snippets.

@mlebkowski
Last active December 21, 2015 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlebkowski/e6fb4f379d3367c3756f to your computer and use it in GitHub Desktop.
Save mlebkowski/e6fb4f379d3367c3756f to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ ! -f ".idea/nutricia.iml" ]; then
echo 'Run this command from the root of your project (.idea/nutricia.iml not found)' >&2
exit 1;
fi
echo 'nutricia.iml filter=phar' >> .git/info/attributes
# on disk, there is never a trailing slash
git config --global filter.phar.smudge 'sed s,[.]phar/,.phar,g'
# when checking in, first strip the trailing slash, then add it (avoid double slashes), and remove newline at end of file
git config --global filter.phar.clean 'sed -e s,[.]phar/,.phar,g -e s,[.]phar,.phar/,g | perl -pe "chomp if eof" '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment