此命令通过windows的"命令"shell在git 2.30.0.windows.1中工作。
git checkout [commit hash] -- */migrations/*
它不适用于Mate terminal或bash(git 2.17(。问题是它们替换了目录*/migrations/*
的当前内容(这些目录是空的,或者没有我想要从中提取的提交时存在的文件(。无论我是单报价还是双报价,Mate终端都会这样做。
如果我调用Bash,然后在新的命令行中添加单引号或双引号,git会说它没有任何真正称为*/migrations/*
:的文件
error: pathspec '*/migrations/*' did not match any files known to git
如果我一次替换一个目录,我可以获得迁移文件的内容,但有20多个迁移文件夹,我想我只是错过了一些关于如何从Linux终端获得我想要的东西的知识。有人能建议我应该做什么吗?
此*/migrations/*
语法指的是where路径。无论是root还是当前工作目录
在使用git
:进行checkout
之前,先使用ls
命令尝试这些操作
*migrations/*
./*migrations/*
$PWD/migrations/*
如果ls
的输出正确,则将其应用于git checkout ...
测试1
ls */tmp/*
ls: cannot access '*/tmp/*': No such file or directory
测试2
ls /tmp/*
it has output ...
it has output ...