I've been trying a lot of different configurations to try to stop Git from inserting CRs (carriage returns). I have a local file that has LF (not CRLF) line endings in the source repo:
$ cat -vT Source/watchr.bat
echo OFF
echo ==========================================================
echo ==========================================================
echo The "watchr" command is deprecated.
echo The new command is sidekick.bat
echo " _
echo "| |
echo "| |_ _ _ _ __ ___
Note: no ^M
, so there are no CRs in there.
This is one of about 80 files, so a commit will create massive
needless churn in the Git history.
Now look at the output from git diff
:
$ gd -R Source/watchr.bat
+echo OFF^M
+echo ==========================================================^M
+echo ==========================================================^M
+echo The "watchr" command is deprecated.^M
+echo The new command is sidekick.bat^M
+echo " _ ^M
+echo "| | ^M
+echo "| |_ _ _ _ __ ___ ^M
Argh, ^M
on every line. Why? How?
The settings :
$ git config --global core.autocrlf
true
$ git config core.autocrlf
false
$ cat -vT .gitattributes
# Set default behavior to automatically normalize line endings.
* text=
Changing the settings to input
(or false
) and auto
(.gitattributes
) has no effect.
Git still wants to insert a CR into the watchr.bat
file.
The .gitconfig
in my home directory also has autocrlf = true
.
How do I stop Git from doing this?
Platform: Git version 1.9.5.msysgit.0, Windows 7.