使用 TortoiseGit 递归添加文件

Adding files recursively using TortoiseGit

我的工作目录中有一个包含文件的文件夹,尚未受版本控制。如果我右键单击该文件夹并转到 TortoiseGit -> 添加,我会收到消息:

There is nothing to add. All the files and folders are either under version control, have been ignored or the global ignore configuration setting.

当我进入文件夹和 select 单个文件时,我可以添加它们。如果我启动命令行并使用 git add --all 它会执行我希望 TortoiseGit 执行的操作并递归添加。

根据 TortoiseGit Manual 它应该能够做到这一点:

Many Adds: You can also use the Add command on folders. In that case, the add dialog will show you all unversioned files inside that versioned folder. This helps if you have many new files and need to add them all at once.

我错过了什么?

问题是 TortoiseGit/Cygwin 中的错误,与以下行有关(在调试日志中执行):

"C:\path\to\git.exe" ls-files --exclude-standard --full-name --others -z -- "dir\subdir"

该命令输出一个文件位置列表,该列表相对于尚未在存储库中的 woking 副本主页,并且 -- "dir\subdir" 在该列表中搜索当前 dir\subdir.[=10 中的文件=]

Cygwin 是 cygwin 输出带有正斜杠的文件 "dir/subdir" 所以搜索 returns 没有文件。

只有在工作副本的第 2 层尝试添加时才会出现此错误(顶层和下层工作,因为它们在搜索中没有“\”)。

编辑:MrTux 的回答是正确的,因为 CygwinHack 值为 false

Cygwin Git 需要在 TortoiseGit 中启用特殊的 HACK 才能启用一些解决方法(参见 https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html 并搜索 "Cygwin")。启用此标志后,您所说的问题就解决了。

PS:请注意 Cygwin Git 在 Windows 上有些问题,因为它甚至没有通过整个测试套件。因此,TortoiseGit 不完全支持它。 Git for Windows 推荐(参考 )