Skip to content

Instantly share code, notes, and snippets.

@jrusbatch
Created October 1, 2014 15:20
Show Gist options
  • Save jrusbatch/a4bdc46fb6f95822e83c to your computer and use it in GitHub Desktop.
Save jrusbatch/a4bdc46fb6f95822e83c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ ! -d ".git" ]; then
echo "Directory is not a repository."
exit 1
fi
if [ ! -f ".gitattributes" ] && [ -f "../gitattributes" ]; then
cp ../gitattributes .gitattributes && git add .gitattributes && git commit -m "Create .gitattributes"
git rm -r --cached .
git add .
git commit -m "Normalize line endings"
fi
if [ ! -f ".gitignore" ] && [ -f "../gitignore" ]; then
cp ../gitattributes .gitignore && git add .gitignore && git commit -m "Create .gitignore"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment