我有一个本地 Git 存储库,我正在尝试将其与远程存储库同步。有一个二进制文件,我没有碰过。但我不能变基,因为一些奇怪的原因:
git config --local core.autocrlf false
git reset --hard --quiet
git clean --force -d
git fetch --quiet
git checkout master
Already on "master"
git rebase --abort
git stash
warning: CRLF will be replaced by LF in test_assets/favicon.ico.
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in test_assets/favicon.ico.
The file will have its original line endings in your working directory.
git rebase --strategy-option=theirs origin/master
Cannot rebase: You have unstaged changes.
Please commit or stash them.
M test_assets/favicon.ico
我能做什么?
一个favicon.ico
文件通常是一个二进制文件。你的 Git 警告:
warning: CRLF will be replaced by LF in test_assets/favicon.ico.
告诉我们,您可能是无意中指示您的 Git 将其视为文本文件。
因此,当文件从存储库中出来时,Git 会根据您的指示修改文件。这就是为什么它显示为已修改,以及为什么在提交告诉 Git 你想要的更改之前不能合并或变基的原因。
解决方案是停止告诉 Git 这个文件是文本。很难确定你在哪里告诉 Git 这个文件是文本,因为这些东西有多种机制,但是如果你有一个.gitattributes
文件,你可以用它来告诉 Git 这个文件,实际上任何名为*.ico
, 绝对不是文本,通过添加以下行:
*.ico -text
到该.gitattributes
文件(然后您可以进行更新git add
并git commit
进行新的提交.gitattributes
)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句