为什么 git checkout --ours/theirs 不起作用?

问题描述 投票:0回答:1

我想从源更新我的模板,所以我使用以下命令:

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 merge-conflict-resolution
1个回答
0
投票

git checkout --ours
git checkout --theirs
仅更改工作树中的文件,但不解决冲突。您仍然需要
git add
签出的文件来标记冲突已解决。

© www.soinside.com 2019 - 2024. All rights reserved.