GIT – force line endings to be ignored

git
Standard

Today, I was driven slightly crazy when trying to see what changes I had made as I was swamped with files which only had differences in their line endings when running a git status.

After trying a lot of different options this was the only one that worked without having to clone the complete repository.

git config --global core.safecrlf false
git diff --name-only
git config --global core.safecrlf true # Best to set this back after finding out what files changed.

Tip: After committing the files returned by ‘git diff –name-only’, run ‘git reset –hard’ to discard all other local file changes. WARNING – this will discard any non-committed files.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s