这个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
糟糕!那改变了分支。 --
将要 check out 的树与要 check out 的文件分开。
git checkout -- master
如果某些怪人将名为 -f
的文件添加到我们的存储库中,这也会对我们有所帮助:
git checkout -f # wrong
git checkout -- -f # right
关于git - Git checkout 双破折号的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13321458/