Git结帐的双重破折号的含义 [英] Meaning of Git checkout double dashes
问题描述
git checkout --ours - - path / to / file.txt
git checkout - 他们 - path / to / file.txt
他们是强制性的吗?它相当于
$ g $ g $ git checkout --ours路径/ to / file.txt
git checkout - 他们的路径/to/file.txt
假设我有一个文件在我的Git仓库中命名为 path / to / file.txt
,并且我想恢复对它的更改。
git checkout path / to / file.txt
现在假设该文件名为 master
...
git checkout master
哎呀!相反,这改变了分支。 -
将您想要签出的树与要签出的文件分开。
git checkout - master
-f
到我们的仓库:错误
git checkout - -f#right
记录在 git-checkout:参数消歧。
What is the meaning of the double dashes before the file name in this git command?
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
Are they mandatory? Is it equivalent to
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
Suppose I have a file named path/to/file.txt
in my Git repository, and I want to revert changes on it.
git checkout path/to/file.txt
Now suppose that the file is named master
...
git checkout master
Whoops! That changed branches instead. The --
separates the tree you want to check out from the files you want to check out.
git checkout -- master
It also helps us if some freako added a file named -f
to our repository:
git checkout -f # wrong
git checkout -- -f # right
This is documented in git-checkout: Argument Disambiguation.
这篇关于Git结帐的双重破折号的含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!