Ask Your Question

How can I avoid "error: pathspec did not match any file(s) known to git." when trying to make a Git checkout with Wildcards?

asked 2023-04-04 13:15:12 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-04-04 13:17:48 +0000

qstack gravatar image

You can combine "git checkout" with "find". This will work assuming the directories "dir1" and "dir2" cause the error...

find . -type f -path "*/path/here" | grep -v -E "(dir1|dir2)" | xargs -I '{}' git checkout -- '{}'
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools

1 follower


Asked: 2023-04-04 13:15:12 +0000

Seen: 21 times

Last updated: Apr 04 '23