threads / discuss / 41960

Paths handled differently by diff and checkout

Subject: Paths handled differently by diff and checkout

## tl;dr

One message between Apr 7, 2016 and Apr 7, 2016.

replies: 0people: 1as markdown or json

Constantin Weißer· Apr 7, 2016, 20:55 UTC · lore
Hi,
say I got a file called "asdf" somewhere in a subdirectory. I can do:
git diff other_branch -- \*asdf

and it will show me the diff *only* of that file (which is the only one that matches), so it works as expected. But if I do on the other hand:

git checkout other_branch -- \*asdf
I get: error: pathspec '*asdf' did not match any file(s) known to git.

which is not what I'm expecting. I figure this is due to the fact that diff does not use parse_pathspec() but handles paths diffently (not sure though)? I'd kind of find it useful to be able to 'git checkout some_branch -- \*.txt' to get all differing text files from another branch for example.

Cheers Constantin

← back to recent threads