git two dashes意味着没有更多的选项 [英] git two dashes means with no more options
问题描述
我正在学习通过代码学校
尝试git,并学习单元1.17使用命令行取消它
git checkout - octocat.txt
和octocat .txt是一个文件,它解释了两条虚线是
它只是保证命令行没有更多的选项$ ' - '后的b $ b。这样,如果碰巧有一个名为
的分支为octocat.txt,它仍然会恢复文件,而不是切换到
同名的分支。
blockquote>
但我无法理解的是,没有选项意味着什么?
由于之后没有选择,为什么它可以通过文件与分支区分开来?
解决方案实际上可以添加或删除被称为
-
意味着停止处理选项,即使看起来像一个选项,例如--help
,它应该作为常规参数处理,如文件名。--help 的文件,否则这将是不可能的。
在git语法,
-
通常也用于指定受影响的文件。例如,git checkout something
可能意味着名为的东西
的结帐分支或称为的东西
。如果您使用git checkout - 某些
,它总是意味着文件,而不是分支。I am learning the
try git by code school
, and to the unit 1.17 Undo it use the command linegit checkout -- octocat.txt
and the octocat.txt is a file then and it explain that the two dash lines is
It's simply promising the command line that there are no more options after the '--'. This way if you happen to have a branch named octocat.txt, it will still revert the file, instead of switching to the branch of the same name.
but what I cannot understand is that what does it means by no options? And since there are no options after, why it can distinguish it by file from branch?
解决方案
--
means stop processing options, and even if something does look like an option, e.g.--help
, it should be treated as usual parameter, like file name instead.Using this syntax, you can actually add or remove file which is called say
--help
, which would be impossible otherwise.In git syntax,
--
is also usually used to specify affected files. For example,git checkout something
could mean either checkout branch namedsomething
or file calledsomething
. If you usegit checkout -- something
, it always means file, not branch.这篇关于git two dashes意味着没有更多的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!