git命令中的--是什么意思?

转载自git命令中的--是什么意思?

                    <h1 id="git%E5%91%BD%E4%BB%A4%E4%B8%AD%E7%9A%84-%E6%98%AF%E4%BB%80%E4%B9%88%E6%84%8F%E6%80%9D%EF%BC%9F">git命令中的<code>--</code>是什么意思?</h1>

看到个命令 git checkout -- files

不知道--代表什么。查了一下,--是linux的东西,用来标志命令项的结束。有点escape的意思。

举例:

git checkout master

上面这条命令中,master可能是一个分支也可能是一个文件.优先会作为分支来理解。如果想取出一个和分支同名的文件,就必须用下面的形式:

git checkout -- master

参考:

http://marklodato.github.io/visual-git-guide/index-zh-cn.html
http://stackoverflow.com/questions/13321458/meaning-of-git-checkout-double-dashes
http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean-also-known-as-bare-double-dash
Git简明手册
book.pdf
git_cheat_sheet.pdf
git_magic.pdf
github-git-cheat-sheet.pdf
progit-zh.761.epub

                </section>
原文地址:https://www.cnblogs.com/sogeisetsu/p/11389721.html