git -C 命令错误

标签 git command

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

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

例子

git -C C:\Users\testDir show ${hash of the commit}:test.csv > C:\Users\anotherTestDir\test.csv

除了当我只有一个提交时,这会按预期工作。

当我有一个提交时,它会导致system cannot find the file specified 错误。

在我再次提交并运行完全相同的命令后,它运行良好。

更奇怪的现象是,当我只有一个提交并使用相对路径时,它有效

例子

git -C .\ show ${hash of the commit}:test.csv > .\test.csv

这是预期的行为吗?如果是,当只有一个提交时能够使用相同命令的解决方案是什么?

Windows 命令

enter image description here

Webstorm 控制台 enter image description here

最佳答案

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

关于git -C 命令错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45992328/

相关文章:

git - 将单个存储库从一台 Atlassian 存储服务器迁移到另一台服务器并维护所有数据

linux - 在 shell 脚本中减去字符串(简单修复)

linux - 如何记忆上一个 bash 命令的参数?

database - 如何更改选择输出的格式(SQLite)

Java : Mac command key for multiple selection in a list (instead of control)

c - 如何像 nm 命令一样显示符号的类型?

Git:Rebase 术语

html - Github页面404找不到文件

python - ubuntu 16.04 中缺少 boost_python3

git - 将 Ansible Galaxy 角色安装为 git 存储库