我有以下工作树状态
$ git status foo/bar.txt
# On branch master
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by us: foo/bar.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
文件foo/bar.txt在那里,我想再次进入"未更改状态"(类似于'svn revert'):
$ git checkout HEAD foo/bar.txt
error: path 'foo/bar.txt' is unmerged
$ git reset HEAD foo/bar.txt
Unstaged changes after reset:
M foo/bar.txt
Run Code Online (Sandbox Code Playgroud)
现在它变得令人困惑:
$ git status foo/bar.txt
# …Run Code Online (Sandbox Code Playgroud) 这个git命令中文件名之前的双破折号是什么意思?
git checkout --ours -- path/to/file.txt
git checkout --theirs -- path/to/file.txt
Run Code Online (Sandbox Code Playgroud)
这是强制性的吗?它等同于
git checkout --ours path/to/file.txt
git checkout --theirs path/to/file.txt
Run Code Online (Sandbox Code Playgroud)