git-checkout

Meaning of Git checkout double dashes

丶灬走出姿态 提交于 2019-11-25 20:22:42
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