問題很簡單。 Git是說我已經添加CR(^M
)到一個文件,Git說我添加'^ M'但core.autocrlf爲真
[email protected] MINGW64 /c/workspace/service (develop)
$ git diff --check
engine/src/main/java/someFile.java:18: trailing whitespace.
+import some.java.package;^M
但我core.autocrlf
設置爲true。
[email protected] MINGW64 /c/workspace/service (develop)
$ git config --get core.autocrlf
true
我沒有遇到過這個問題,不知道是什麼原因導致它。我一直有core.autocrlf
設置爲真,並且從未抱怨在此之前添加^M
。
這裏是git config --list
提供一些個人信息,GUI設置和分支機構設置,以防它需要刪除的輸出。
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
push.default=simple
core.autocrlf=true
core.pager=less -x4
core.trustctime=false
core.editor=vim
core.filemode=false
alias.hist=log --pretty=format:'%ad %C(yellow)%h%C(reset) %s %C(yellow)%an%C(reset)' --date=short
alias.logo=log --oneline
alias.superlog=log --decorate --graph
alias.superlogo=log --decorate --graph --oneline
alias.dry-merge=merge --no-commit --no-ff
gui.recentrepo=C:/sts-workspace/kba-service
merge.tool=vimdiff
merge.conflictstyle=diff3
mergetool.prompt=true
mergetool.keeptemporaries=false
mergetool.keepbackups=false
mergetool.trustexitcode=false
diff.tool=vimdiff
difftool.prompt=true
color.ui=true
credential.helper=cache --timeout=3600
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
你是如何檢出文件的?從哪個操作系統? – CodeWizard
@codeWizard我在Windows上使用Git-for-Windows。我通過'git checkout develop'檢查了它。 –
您是否嘗試在配置更改後刷新回購? https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings – Rabea