Git commit changes all text files every PC change

조회 수: 3 (최근 30일)
Piotr Kluczek
Piotr Kluczek 2021년 2월 3일
편집: Jacob Mathew 2024년 2월 29일
Hello,
Every time I change a PC during development - through cloning pushed changes or just copy-paste - all text files are changed upon first commit:
  • .xml
  • .m
  • .csv
  • .gitignore
  • .txt
  • .prj
The comparison results in response "No differences to display. The files are not identical, but the only differences are in end-of-line characters."
Is there any option to avoid that?

답변 (1개)

Jacob Mathew
Jacob Mathew 2024년 2월 26일
편집: Jacob Mathew 2024년 2월 29일
After reading through your query, I understand that you are facing difficulty with the end of line character that varies between different instances of opening the file. With the limited context provided, here is a suggestion to mitigate this issue:
The difference in end of line character comes from the OS platform’s default values and by what the IDE or editor is using.
If you are using an editor that does not allow you to customise the end of line character, the defaults are:
  • CRLF for Windows
  • LF for Linux
  • CR for Mac
The current end of line character that is in use can be found at the bottom right corner of the MATLAB editor:
Bottom right image of MATLAB Editor showing end of line character
MATLAB editor will always default to the end of line character that was used to save the file. To change the end of line character in MATLAB, follow the instructions in the following MATLAB Answer links:

카테고리

Help CenterFile Exchange에서 Source Control에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by