git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Paths handled differently by diff and checkout

From
CWConstantin Weißer <i7c@posteo.de>
Date
Apr 7, 2016, 20:55 UTC
Message-ID
<146006251650.27005.6715475336032533932@localhost.localdomain>
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

Message 1 of 1 in “Paths handled differently by diff and checkout”
  1. Constantin WeißerApr 7, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.