简体   繁体   English

Git结帐:星号pathspec不起作用

[英]Git checkout: Asterisk pathspec not working

This works fine: 这工作正常:

git checkout **/pom.xml

But we can't run this against another branch 但是我们不能对另一个分支运行它

git checkout anotherbranch **/pom.xml
git checkout anotherbranch -- **/pom.xml

error: pathspec '**/pom.xml' did not match any file(s) known to git.

We're on Windows 7/DOS. 我们使用的是Windows 7 / DOS。

Anyone know why? 有人知道为什么吗?

Note that it works fine without the ** . 请注意,如果没有** ,它可以正常工作。 This would checkout the pom.xml from the root. 这将从根目录签出pom.xml。 But we're trying to checkout all pom.xml's that are in the directory tree. 但是,我们正在尝试检出目录树中的所有pom.xml。

I think what's happening here is: 我认为这里发生的是:

Per torek : Per torek

The shell replaces * with all the file names in your current working directory,1 and then having done that, then runs git Shell用当前工作目录中的所有文件名替换* 1,然后执行该操作,然后运行git

I think that the current branch/working directory has files matching the pathspec that are not in anotherbranch . 我认为当前的分支/工作目录中包含与pathspec匹配的文件,这些文件不在 anotherbranch And this is causing the error when we attempt effectively run git checkout anotherbranch unknown_file . 当我们尝试有效地运行git checkout anotherbranch unknown_file时,这会导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM