此命令的作用是“git checkout -- .”
What does this Command do " git checkout -- . "
我是使用 git 的初学者,我想知道这个 git 命令是什么意思
git checkout -- .
我知道 git checkout 用于在分支机构之间切换,但我不知道上面的选项意味着什么我试图查看 toturials 但我没有这样的选项
--
和 .
都不是 git 特定的:
The first --
argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the '-'
character.
.
是当前目录。
git checkout is for switching between branches
如果您查看 https://git-scm.com/docs/git-checkout,此命令的格式为
git checkout [<tree-ish>] [--] <pathspec>…
原来如此
Overwrite[s] paths in the working tree by replacing with the contents in the index or in the <tree-ish>
(most often a commit).
"Paths" 是 .
(当前目录)并且 "the <tree-ish>
" 是 HEAD
(当前提交 Git 指向),因为你没有t指定另一个。
检查当前目录和子目录。
tymtam@x:/mnt/c/tmp/x$ git status
modified: x.txt
modified: z/z1.txt
modified: z/z2/z2_1.txt
tymtam@x:/mnt/c/tmp/x$ cd z // changing to subdirectory
tymtam@x:/mnt/c/tmp/x/z$ git checkout -- .
tymtam@x:/mnt/c/tmp/x/z$ git status
modified: ../x.txt
(为简洁起见,我删除了 git 喋喋不休的内容)
我是使用 git 的初学者,我想知道这个 git 命令是什么意思
git checkout -- .
我知道 git checkout 用于在分支机构之间切换,但我不知道上面的选项意味着什么我试图查看 toturials 但我没有这样的选项
--
和 .
都不是 git 特定的:
The first
--
argument that is not an option-argument should be accepted as a delimiter indicating the end of options. Any following arguments should be treated as operands, even if they begin with the'-'
character.
.
是当前目录。
git checkout is for switching between branches
如果您查看 https://git-scm.com/docs/git-checkout,此命令的格式为
git checkout [<tree-ish>] [--] <pathspec>…
原来如此
Overwrite[s] paths in the working tree by replacing with the contents in the index or in the
<tree-ish>
(most often a commit).
"Paths" 是 .
(当前目录)并且 "the <tree-ish>
" 是 HEAD
(当前提交 Git 指向),因为你没有t指定另一个。
检查当前目录和子目录。
tymtam@x:/mnt/c/tmp/x$ git status
modified: x.txt
modified: z/z1.txt
modified: z/z2/z2_1.txt
tymtam@x:/mnt/c/tmp/x$ cd z // changing to subdirectory
tymtam@x:/mnt/c/tmp/x/z$ git checkout -- .
tymtam@x:/mnt/c/tmp/x/z$ git status
modified: ../x.txt
(为简洁起见,我删除了 git 喋喋不休的内容)