8

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?

user229044
  • 232,980
  • 40
  • 330
  • 338
Sarun Sermsuwan
  • 3,608
  • 5
  • 34
  • 46

2 Answers2

15

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 .).

u-punkt
  • 4,744
  • 1
  • 16
  • 7
  • Note that this is a path specifier common to most Unix-like file systems, it isn't Git-specific. `.` is always the current directory, `..` is always the parent directory. – user229044 Nov 28 '11 at 06:10
3

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.

Jacob Groundwater
  • 6,581
  • 1
  • 28
  • 42