Skip to content

Instantly share code, notes, and snippets.

@ejhayes
Created November 6, 2013 23:11
Show Gist options
  • Save ejhayes/7345900 to your computer and use it in GitHub Desktop.
Save ejhayes/7345900 to your computer and use it in GitHub Desktop.
Force line endings for a project to always be LF (*nix) and to automatically convert any encountered CRLF line endings to LF before making a commit. This is useful if you have a project that runs with vagrant on ubuntu, but you are doing development with windows.
* text=auto
*.jpg binary
*.gif binary
*.png binary
#!/bin/bash
# This is useful for a project that is checked out on windows, but all files are run on a linux machine
# otherwise we run into an issue where windows line endings are seen on the linux side which sometimes
# causes unexpected behavior.
git config core.eol lf
git config core.autocrlf input
git rm --cached --rf .
git reset --hard
git commit -m "Normalize line endings."

Comments are disabled for this gist.