这个git命令中的文件名之前的双破折号是什么意思?Git结帐双破折号的含义
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
它们是强制性的吗?它是相当于
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
这个git命令中的文件名之前的双破折号是什么意思?Git结帐双破折号的含义
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
它们是强制性的吗?它是相当于
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
假设我有一个名为我的Git仓库path/to/file.txt
文件,我想恢复它的变化。
git checkout path/to/file.txt
现在假设文件被命名为master
...
git checkout master
哎呦!相反,这改变了分支。 --
将要检出的树与要检出的文件分开。
git checkout -- master
它也帮助我们,如果一些freako添加了一个名为-f
我们的库文件:
git checkout -f # wrong
git checkout -- -f # right
双破折号“ - ”的意思是“命令行标志的结束”,即它告诉前面的命令不要试图解析命令行选项后面的内容。
这是一个shell表达式。请参阅http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean – iltempo
@iltempo:Git略有不同。对于Git,在树和路径看起来相同的情况下,它将树与路径分开。 –
@Dietrich_Epp。我懂了。感谢澄清。 – iltempo