Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dot sign's meaning in git checkout command

if I use git command like this:

git checkout -- .

I know its effect is to discard all unstaged files everywhere.

Can anyone tell me what is the meaning of the dot sign (.) in this command?

like image 332
Sarun Sermsuwan Avatar asked Nov 26 '11 00:11

Sarun Sermsuwan


2 Answers

The dot stands for the current directory. The command you've mentioned means: Do a git checkout of the current directory (recursively). The double-dashes separate options from filespecs (like .).

like image 92
u-punkt Avatar answered Sep 21 '22 22:09

u-punkt


The dot (.) refers to the current working directory.

You are asking git to checkout the current directory from the checked out branch. The double-dash is used to separate references, such as master or HEAD from file paths, such as myfile.cpp.

like image 31
Jacob Groundwater Avatar answered Sep 20 '22 22:09

Jacob Groundwater