linux - Fixing the line-endings in a Git repository using the `.gitattributes` file -


What's the need for fixing:

I have a .md File, which contains an essay that I am writing to.

I edit the file from some different computers, running a Linux and running a pair of Windows.

Git diff Now in Windows, where I made some changes, I can show my essay as well as separate lines of text ... to be removed Everything has been replaced and replaced by a long line where the paragraphs ^ m s.

I know that ^ M refers to Windows' CLRF line end

Diff means that I have started the file (fully possible, I do not remember) in Linux and since then it has been saved in Windows and all The end of the line has been changed.

D To be able to open files in both OSs, as they should be displayed, and displays a diff result, which shows the line breaks ( ^ M placeholders) and only the actual content changes.

What I have tried:

I did something, read line-endings and tried to follow the Geet settings, and even the commands.

As it stands, I have a .gitattributes file which is on the top-level repository which I have created myself for the repository. There are only two rows:

  # These files are text and must be normalized (LF from Windows CLRF) * .md text   

I have tried ():

  git rm --cached -r git reset - add hard git git commit -m "normal end line"   

and this ():

  git rm --cached -r GIT config core.autocrollf input git intercache --name-only -z | In the second case, the last order tells me that there is nothing to commit. (I do not even like the idea of ​​changing  core.autoclrf  because I try to do it purely through  .gitattributes , but I'm frustrated I am.)  

Happy to provide more details on answering questions. Any ideas where I was going wrong? Do I miss a step?

Try to just use

  *. MD Text instead of EOL = Original   

  *. MD text   

in your .gitattributes.

I had installed a small test repo with a CR-LF file and followed my first procedure to generalize:

  git rm --cached -r GIT Reset - Add hard GIT Git commit -m "Normal look the end of the line"   

Correctly normalized file at check-in But, oddly, it is still CR- LF is kept out while checking out, even though I'm on OSX.

It is believed that the default value for core.eol is original. So, I hope GIT can only check my files using LF. But it seems that for some reason, this is not just doing this, therefore, my understanding of gittiments is messy, or we have a bug to hit ...

In any case, Clearly EOL = Country Setting Jitatites did the trick for me, as I said.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -