I'm quite sure I understand what No newline at end of file means. I want to provide a pull request of a branch which I created long time ago and rebased (commits might be from the time before .gitattributes
has been added). I see that some .java
source code files have only the change
-}
\ No newline at end of file
+}
regardless of the configuration, I'd simply like these changes to be excluded from the PR commit. I'd like to avoid picking the changes with git difftool
and broaden my understanding of git
.
The thing is that I already don't understand how this change can exist since there's a .gitattributes
with
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
*.java text
*.css text
*.js text
*.xml text
*.dtd text
*.xsl text
*.properties text
*.txt text
*.svg text
*.yml text
*.md text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.gif binary
*.jpg binary
*.jpeg binary
*.eot binary
*.ttf binary
*.woff binary
*.woff2 binary
in the repository and I ran git rm --cached -r . && git add .
which should convert all line endings to LF because of *.java text
(also tried *.java text
), but there're no changes shown (against HEAD
) and git diff
still shows the line ending difference.
Also find ./ -type f -name '*.java' -exec dos2unix {} \;
doesn't causes any changes to be recognized by git status
and git diff master
still displays the line ending change (while the working directory has no staged or unstaged changes).
I'm not interested in hiding the changes, like git diff --ignore-all-space
would do.
I'm using git
2.17.1 on Ubuntu 18.04.