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 -- '{}'
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
Asked: 2023-04-04 13:15:12 +0000
Seen: 5 times
Last updated: Apr 04
How can I speed up a large Git Repository with lots of Directories?
How can I commit only files that were modified in Git, not files that were deleted?
Git: Is it a good Idea to add the same Submodule multiple times as Submodule a Submodule?
How can I check out a Branch in Git?
Is it possible to refresh the index when Git stash pop requires merging?