V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
SGL
V2EX  ›  程序员

Claude 和 ChatGPT 技能比拼之 git rebase

  •  
  •   SGL · 16 小时 39 分钟前 · 420 次点击
    问题:
    ```sh
    我在 branchA 上执行 git rebase master ,然后出现冲突文件 a,b ,我想要丢弃 branchA 中的 a,b ,保留 master 中的 a,b 。我该怎么做,给出命令。
    ```

    Claude4.5 免费版(网页):
    ```sh
    # 对于文件 a 和 b ,使用 master 的版本
    git checkout --ours a
    git checkout --ours b

    # 标记冲突已解决
    git add a b

    # 继续 rebase
    git rebase --continue
    ```

    ChatGPT 免费版(网页):
    ```sh
    # 对文件 a 使用 master (即目标分支)的版本
    git checkout --theirs -- a

    # 对文件 b 使用 master (即目标分支)的版本
    git checkout --theirs -- b

    # 标记解决冲突
    git add a b

    # 继续 rebase
    git rebase --continue


    ```

    ChatGPT Plus(网页 Thinking 模式):
    ```sh
    # 处于 rebase 冲突状态时:
    git checkout --theirs -- a b # 选用“theirs”,在 rebase 中指的是 master 的版本
    git add a b # 标记冲突已解决
    git rebase --continue

    ```
    目前尚无回复
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   4973 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 01:10 · PVG 09:10 · LAX 18:10 · JFK 21:10
    ♥ Do have faith in what you're doing.