我试图仅提供并提交相关更改。
在我的中.gitconfig,我删除了core.autocrlf = input行以跳过行结束转换。
现在我不知道为什么,但我的行结尾仍在转换
已经检查了给出的类似解决方案,但没有任何效果。我只想提交非空白更改。
我试过
git add myfile
git diff HEAD
--- /dev/null
+++ b/profiles/minimal/minimal.info
@@ -0,0 +1,6 @@
...content of file here (practically all is changed)
Run Code Online (Sandbox Code Playgroud)
现在删除空白
git diff HEAD -w | git apply --cached --ignore-whitespace
Run Code Online (Sandbox Code Playgroud)
我得到一个错误
error: myfile: already exists in index
Run Code Online (Sandbox Code Playgroud)
您只是尝试添加已添加到索引中的文件。
您不能多次添加它。看起来您已经执行了此命令或使用手动添加文件git add
该命令的作用是什么(以便其他人可以学习):
git diff HEAD -w | git apply --cached --ignore-whitespace
Run Code Online (Sandbox Code Playgroud)
它执行以下操作:
# Generate the diff between HEAD to index
git diff HEAD -w
# apply the patch to the index
Run Code Online (Sandbox Code Playgroud)
git-apply将补丁应用于文件和/或索引
| 归档时间: |
|
| 查看次数: |
921 次 |
| 最近记录: |