What I would like to do is to checkout a single file or a set of files with a common name part like this
git checkout myBranch */myFile.md and
<
For me the task was to checkout several files named after one pattern:
./a/b/c/FirstTest.java.d/e/f/SecondTest.java./g/h/i/ThirdTest.javaI've used this bash command:
# 1. Find files named after "*Test.java" pattern.
# 2. Execute checkout command on every found file.
find . -name "*Test.java" -exec git checkout master {} \;
Also firstly you can test the find command with simple echo, which just prints a given text ({} in our case, which will be replaced with current found filename by shell):
find . -name "*Test.java" -exec echo {} \;