V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
YanSeven
V2EX  ›  程序员

Claude 和 ChatGPT 技能比拼之 git rebase

  •  
  •   YanSeven · Oct 21, 2025 · 1587 views
    This topic created in 201 days ago, the information mentioned may be changed or developed.
    问题:
    ```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

    ```
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   873 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 20:21 · PVG 04:21 · LAX 13:21 · JFK 16:21
    ♥ Do have faith in what you're doing.