Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git-C命令错误_Git_Command - Fatal编程技术网

git-C命令错误

git-C命令错误,git,command,Git,Command,我不知道这是否是git的预期现象,但我想我可能发现了一个奇怪的bug 我有一个脚本,可以将文件从特定的commit复制到另一个位置 范例 git -C C:\Users\testDir show ${hash of the commit}:test.csv > C:\Users\anotherTestDir\test.csv git -C .\ show ${hash of the commit}:test.csv > .\test.csv 除了我只有一次提交之外,这与预期一样有

我不知道这是否是git的预期现象,但我想我可能发现了一个奇怪的bug

我有一个脚本,可以将文件从特定的commit复制到另一个位置

范例

git -C C:\Users\testDir show ${hash of the commit}:test.csv > C:\Users\anotherTestDir\test.csv
git -C .\ show ${hash of the commit}:test.csv > .\test.csv
除了我只有一次提交之外,这与预期一样有效

当我有一次提交时,它会使
系统无法找到指定的文件
错误

在我执行另一个提交并运行完全相同的命令之后,它工作得非常好

更奇怪的现象是,当我只有一个提交和使用相对路径时,它就工作了

范例

git -C C:\Users\testDir show ${hash of the commit}:test.csv > C:\Users\anotherTestDir\test.csv
git -C .\ show ${hash of the commit}:test.csv > .\test.csv
这是预期的行为吗?如果是,当只有一个提交时,能够使用同一个命令的解决方案是什么

Windows命令

Webstorm控制台

根据注释:使用
C:/Users/testDir
而不是
C:\Users\testDir
作为参数。

如果只测试
git-C:\Users\testDir show${commit的哈希}:test.csv
一次commit会怎么样?你有同样的错误吗?如果有准确的输出就好了。你的意思是只显示而不复制,对吗?是的,同样的错误。非常奇怪@gsi frank。你自己试试看,我很感兴趣。你能测试一下git-C:/Users/testDir show${hash of the commit}:test.csv吗?如果不行,那么就测试一下git-C“C:/Users/testDir”show${hash of the commit}:test.csv
?在OSX中为我工作过,所以我想这是一个windows shell git字符scape的东西。在windows中使用git
2.14.1.windows.1
git
cmd.exe
version
2.14.1.windows.1
也可以