我想从源更新我的模板,所以我使用以下命令:
git remote add template https://github.com/ObsidianPublisher/template-netlify-vercel
git pull template main --allow-unrelated-histories
然后我列出所有冲突文件:
git diff --name-only --diff-filter=U
A
B
C
到目前为止一切顺利。我想保留A。其余的应该被覆盖。我用:
git checkout --ours -- A
git checkout --theirs -- .
但是再检查一遍还是不行:
git diff --name-only --diff-filter=U
A
B
C
这是为什么?
git checkout --ours
和git checkout --theirs
仅更改工作树中的文件,但不解决冲突。您仍然需要 git add
签出的文件来标记冲突已解决。