我使用git svn
和git2.35.1签出了一个SVN存储库。它已经工作了很长一段时间,但最近我发现了鬼的不同之处:
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: tools/a.cpp
modified: tools/b.cpp
modified: tools/c.cpp
...
如果我git checkout .
,我得到:
$ git checkout .
Updated 28 paths from the index
但是没有什么变化,即git status
一直表现出相同的差异。我不能从远程git svn rebase
服务器进行SVN
:
$ git svn rebase
tools/a.cpp: needs update
tools/b.cpp: needs update
tools/c.cpp: needs update
...
当我使用git diff
时,我会得到这个列表中所有文件的完全不同。使用git diff -w
说
$ git diff -w
warning: LF will be replaced by CRLF in tools/a.cpp.
The file will have its original line endings in your working directory
我理解这是由本地git
签出和SVN
服务器之间的空格变化造成的。我只是找不出任何组合的选项或配置设置,以解决问题。
编辑:
实际上,我找到了一个更新存储库的解决方案:在提交tools/a.cpp
和朋友之前,我检查了修订版,然后在那里做了一个git svn rebase
。这将更新到最新的修订版。但是问题再次出现,如果我想进一步更新,我必须重复这个还原和重基过程,所以这不是一个真正的解决方案,特别是对于大型历史。
发布于 2022-05-26 06:56:21
用Git 2.37, the warning will change and become。
在本机行尾不是LF (例如Windows)的平台上,这些索引文件触发:
在
的工作副本'
tools/a.cpp
',LF
将由CRLF取代下一次Git触摸它。
首先要确保git config core.autocrlf
is set to false
,然后再试一次,看看是否有任何自动更改。
至少:
git config --global core.autocrlf false
https://stackoverflow.com/questions/72350029
复制相似问题