dot sign's meaning in git checkout command

2019-02-07 05:32发布

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?

2条回答
何必那么认真
2楼-- · 2019-02-07 06:06

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.

查看更多
放我归山
3楼-- · 2019-02-07 06:12

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

查看更多
登录 后发表回答