问题:sh<br />我在 branchA 上执行 git rebase master ,然后出现冲突文件 a,b ,我想要丢弃 branchA 中的 a,b ,保留 master 中的 a,b 。我该怎么做,给出命令。<br />
Claude4.5 免费版(网页):sh<br /># 对于文件 a 和 b ,使用 master 的版本<br />git checkout --ours a<br />git checkout --ours b<br /><br /># 标记冲突已解决<br />git add a b<br /><br /># 继续 rebase<br />git rebase --continue<br />
ChatGPT 免费版(网页):sh<br /># 对文件 a 使用 master (即目标分支)的版本<br />git checkout --theirs -- a<br /><br /># 对文件 b 使用 master (即目标分支)的版本<br />git checkout --theirs -- b<br /><br /># 标记解决冲突<br />git add a b<br /><br /># 继续 rebase<br />git rebase --continue<br /><br /><br />
ChatGPT Plus(网页 Thinking 模式):sh<br /># 处于 rebase 冲突状态时:<br />git checkout --theirs -- a b # 选用“theirs”,在 rebase 中指的是 master 的版本<br />git add a b # 标记冲突已解决<br />git rebase --continue<br /><br />
