I am working in a windows-only working environment with developers using all kinds of tools to edit their files. We are using .git
along with the atlassian stack to version our code. I like almost all of it.
I have just recently finished fighting a long and hard fight to wrap my head around how and why git interprets line endings and what core.autocrlf
does. We've decided to use core.autocrlf true
and all is almost well.
I would LOVE to know how to change this behavior of git status
:
CRLF
line endings.I change the line endings to LF
$ git status
On branch somebranch
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Src/the_file_i_changed_to_LF.js
But then...
$ git commit -a
warning: LF will be replaced by CRLF in Src/the_file_i_changed_to_LF.js.
The file will have its original line endings in your working directory.
On branch somebranch
nothing to commit, working directory clean
To this one:
CRLF
line endings.I change the line endings to LF
$ git status
On branch somebranch
nothing to commit, working directory clean
Is this possible?
I believe the possible duplicate does not hold the answer I am looking for. I would like to emphasize that I do (think I) know what my setting core.autocrlf true
does and want to keep it that way. What I'm interested in is either not detecting changes in git status
which will not be committed anyway, or understanding why this is not possible.
When you set core.autocrlf true
all files in your working directory will have CRLF
line ending (regard less of the actual line ending in the repository). For most windows users this is good enough.
From your question I understand you want to have your working directory files (=local file) with LF
. So, here you should be using core.autocrlf input
. This will give you the exact line ending as in the repository (but still it will make sure all check-ins are made with LF
).
Read more about the difference of true, false, input in this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With