Re: checkout extra files
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:37
Angelo Borsotti [off-list ref] writes:
$ mkdir gittest $ cd gittest $ git init Initialized empty Git repository in d:/gittest/.git/
At this point, the working tree presumably is empty.
$ touch f1 $ git add f1 $ git commit commit -m "first commit" [master (root-commit) e6f935e] first commit 0 files changed create mode 100644 f1
Now we have f1 in the working tree in the index, and in the tree of the commit.
$ touch f2
Now we have f1 and f2 in the working tree.
$ git checkout e6f9 -- *
That is the same as "git checkout e6f935e -- f1 f2", as the shell expanded "*" into "f1" and "f2".
error: pathspec 'f2' did not match any file(s) known to git. Note the error.
Yes?
It is clear that the set of file names that git checkout is taking is
the union of the ones that
match the specified path ('*') in the work directory (gittest) with
the ones that match the
path in the specified commit (e6f9).The command tells git to check out "f1" and "f2" out of the tree of e6f935e, and git found "f1" but did not find "f2" and reported an error. I do not see a room or need for "union" to come into the picture to explain what we see in the above transcript.