I'm using Git for Windows 2.9.3.windows.1 via Git Bash.
Now dev branch is checked out and I want to checkout some files which are now not in the working directory from master branch. The files have the same name and are stored in similar directories like:
path/to/a/file.txt
path/to/that/file.txt
path/to/the/file.txt
path/to/this/file.txt
I'm sure I can do that by specifying the files one by one:
git checkout master path/to/a/file.txt path/to/that/file.txt path/to/the/file.txt path/to/this/file.txt
But it's a hassle. Instead I want to use a wildcard like:
git checkout master path/to/*/file.txt
When I tried this command an error occurred:
error: pathspec 'path/to/*/file.txt' did not match any file(s) known to git.
Then, I learned pathspec and tried:
git checkout master path/to/**/file.txt
git checkout master 'path/to/*/file.txt'
git checkout master 'path/to/**/file.txt'
git checkout master */file.txt
git checkout master '*/file.txt'
git checkout master **/file.txt
git checkout master '**/file.txt'
git checkout master ':(glob)path/to/*/file.txt'
git checkout master ':(glob)path/to/**/file.txt'
git checkout master ':(glob)**/file.txt'
All of them didn't work due to the same error. They didn't work even if I add --
between master and pathspec.
How can I use a wildcard in pathspec?
--
withgit checkout master -- path/to/*/file.txt
--
didn't solve. I added note about--
.