Git 区分大小写 Windows 7
Git case sensitive Windows 7
我正在学习git所以如果之前已经回答过,请原谅我。我在工作目录中添加了一个文件 README.txt
。 git status
告诉我这是唯一未跟踪的文件。我然后运行git add readme.txt
。 运行 git status
现在再次告诉我 README.txt
是唯一未跟踪的文件。但是,如果我然后 运行 git add README.txt
它现在显示为一个新文件。这是否意味着 git 正在添加不存在的文件 readme.txt
的快照?我不明白,因为我认为 git 不区分大小写。
您的 NTFS 是不区分大小写的。所以如果 git 询问 "README.txt" 是否仍然存在,它会被告知 "yes" 即使你现在有 "readme.txt".
我建议告诉 git 用
完全忘记 "README.txt"
git rm --cached README.txt
然后再次添加 readme.txt。
I thought that git was case insensitive.
不是真的。有一个配置设置 core.ignorecase
,通常在 Windows 中设置为 true;文档说
If true, this option enables various workarounds to enable Git to work better
on filesystems that are not case sensitive
但这离说 Git 不区分大小写还有很长的路要走。我重现了你所做的,我认为你发现了一个错误。
$ git checkout -b test
Switched to a new branch 'test'
$ echo hello > README.txt
$ git status
On branch test
Untracked files: (use "git add <file>..." to include in what will be committed)
README.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git add readme.txt
$ git status
On branch test
Untracked files: (use "git add <file>..." to include in what will be committed)
README.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git diff --cached
$
应该发生以下两种情况之一:Git 应该在我(和您)添加时抱怨 readme.txt
不存在,或者它应该添加 README.txt
到缓存。它没有做任何一件事情:git add
没有错误,git diff --cached
没有列出结果。
所以我的建议是将 Git 命令视为区分大小写,即使 core.ignorecase
设置为 true。
我正在学习git所以如果之前已经回答过,请原谅我。我在工作目录中添加了一个文件 README.txt
。 git status
告诉我这是唯一未跟踪的文件。我然后运行git add readme.txt
。 运行 git status
现在再次告诉我 README.txt
是唯一未跟踪的文件。但是,如果我然后 运行 git add README.txt
它现在显示为一个新文件。这是否意味着 git 正在添加不存在的文件 readme.txt
的快照?我不明白,因为我认为 git 不区分大小写。
您的 NTFS 是不区分大小写的。所以如果 git 询问 "README.txt" 是否仍然存在,它会被告知 "yes" 即使你现在有 "readme.txt".
我建议告诉 git 用
完全忘记 "README.txt"git rm --cached README.txt
然后再次添加 readme.txt。
I thought that git was case insensitive.
不是真的。有一个配置设置 core.ignorecase
,通常在 Windows 中设置为 true;文档说
If true, this option enables various workarounds to enable Git to work better on filesystems that are not case sensitive
但这离说 Git 不区分大小写还有很长的路要走。我重现了你所做的,我认为你发现了一个错误。
$ git checkout -b test
Switched to a new branch 'test'
$ echo hello > README.txt
$ git status
On branch test
Untracked files: (use "git add <file>..." to include in what will be committed)
README.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git add readme.txt
$ git status
On branch test
Untracked files: (use "git add <file>..." to include in what will be committed)
README.txt
nothing added to commit but untracked files present (use "git add" to track)
$ git diff --cached
$
应该发生以下两种情况之一:Git 应该在我(和您)添加时抱怨 readme.txt
不存在,或者它应该添加 README.txt
到缓存。它没有做任何一件事情:git add
没有错误,git diff --cached
没有列出结果。
所以我的建议是将 Git 命令视为区分大小写,即使 core.ignorecase
设置为 true。