Search code examples
tortoisegit

TortoiseGit list all of the files in the repository while commit code because of the line ending changed


TortoiseGit list all of the files in the repository while commit code because the line ending changed.

The line ending in the repository is LF and has been changed to CRLF on my local windows machine.

When I try to commit my code change, all of the files are list in commit page, the only difference of the unchanged file is line ending.

How can I make TortoiseGit only list the changed files and ignore line endings?

Thanks!


Solution

  • There is no general way to ignore EOL changes.

    You could consider automatic CRLF conversion in Git.

    The recommended way is to use a .gitattributes file; you could also use the AutoCRLF approach pointed out by https://stackoverflow.com/a/67356631/3906760, however, that is not recommended any more.

    E.g. if you put the following line into it *.txt text that means that all *.txt files are stored with LF line ending in the repository and on checkout these are stored with CRLF in your working tree. This also means that the CRLF is automatically removed when committing so that the files are stored with LF only in the repository.

    You can also try to use editors that are fully compatible with LF-EOLs.