Git stash: prevent converting line delimiters

In my regular repositories core.autocrlf=true

on Windows, I had a line-delimited file \n

(intentionally). After saving it as a stash and applying it later, it was changed to \r\n

, which was a bit unexpected for me.

How can I make stash save and apply not convert any line separator, but keep the files as they are?

+3


source to share


2 answers


You can disable crlf conversion before application.

git config --global core.autocrlf false

      



You can turn it back after using the cache.

+1


source


You can use .gitattributes

or .git/info/attributes

to change CRLF handling for specific files. For example,

*.special text eol=lf

      



will always convert \n

to a Git repository. See man gitattributes for details .

+1


source







All Articles