Skip to content

Commit caae319

Browse files
committed
Document file-glob for "git checkout -- '*.c'"
Just like we give a similar example in "git add" documentation. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 785ee49 commit caae319

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Documentation/git-checkout.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,18 @@ $ git checkout hello.c <3>
367367
<2> take a file out of another commit
368368
<3> restore hello.c from the index
369369
+
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+
+
370382
If you have an unfortunate branch that is named `hello.c`, this
371383
step would be confused as an instruction to switch to that branch.
372384
You should instead write:

0 commit comments

Comments
 (0)