Angelo Borsotti <angelo.borsotti@xxxxxxxxx> writes: > Hello, > > the man page of git checkout states: > > git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>... > > It updates the named paths in the working tree from the index file or > from a named <tree-ish> ... > > This means that for each file denoted by pathspec, git tries to > restore it from the tree-ish. > However, it seems that git does more than this: it restores also files > that are not denoted > by pathspec. > This sequence of commands shows it: > > $ mkdir gittest > $ cd gittest > $ git init > Initialized empty Git repository in d:/gittest/.git/ > $ touch f1 > $ git add f1 > $ git commit commit -m "first commit" > [master (root-commit) 94d882a] first commit > 0 files changed > create mode 100644 f1 > $ rm f1 > $ git checkout 94d8 -- * > $ ls > f1 > > Note that the work directory is empty when the checkout is done, and > that the checkout restores f1 > in it, a file that is not denoted by the * pathspec. The '*' pathspec refers to every file. There are no files in the current directory, so your shell can't expand the glob and passes it to git, which then looks and sees that the glob expands to f1 in the given commit which it then checks out. cmn -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html