Document file-glob for "git checkout -- '*.c'"
Just like we give a similar example in "git add" documentation. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 4, 2012 at 08:28 UTC
caae319e49e236205d463de2ecf24ce5aae642ab
1 file changed
+12
Documentation/git-checkout.txt
+12
@@ -367,6 +367,18 @@ $ git checkout hello.c <3>
367
<2> take a file out of another commit
368
<3> restore hello.c from the index
369
+
370
+If you want to check out _all_ C source files out of the index,
371
+you can say
372
++
373
+------------
374
+$ git checkout -- '*.c'
375
+------------
376
++
377
+Note the quotes around `*.c`. The file `hello.c` will also be
378
+checked out, even though it is no longer in the working tree,
379
+because the file globbing is used to match entries in the index
380
+(not in the working tree by the shell).
381
++
382
If you have an unfortunate branch that is named `hello.c`, this
383
step would be confused as an instruction to switch to that branch.
384
You should instead write: