Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git -C command bug

Tags:

git

command

I don't know if this is the expected phenomenon of git but I think I may have found a strange bug.

I have a script that copies file from specific commit to another location

example

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

This works as expected EXCEPT when I only have one commit.

When I have a single commit, it makes system cannot find the file specified error.

After I do another commit and run exact same command, it works perfectly.

Even stranger phenomenon is that when I only have one commit and use relative path, it works

example

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

Is this an expected behaviour? If it is, what would be the solution to be able to use the same command when there's only one commit?

Windows CMD

enter image description here

Webstorm console enter image description here

like image 383
forJ Avatar asked Sep 06 '26 00:09

forJ


1 Answers

Per the comments: use C:/Users/testDir instead of C:\Users\testDir as parameter.