# 提示：（例如，'git pull ...'）然后再推送。

- **ID:** `git/diverged-branches-fast-forward-rejected`
- **领域:** git
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

本地分支与远程分支已分叉，因此快速推送被拒绝；用户需要先整合远程更改。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.30 | active | — | — |
| git 2.35 | active | — | — |
| git 2.40 | active | — | — |

## 解决方案

1. ```
   Run 'git pull origin main --ff-only' to fast-forward if possible, then retry push
   ```
2. ```
   Run 'git pull origin main --rebase' to rebase local commits on top of remote, then push
   ```
3. ```
   If divergence is intentional, use 'git push --force-with-lease' to safely override remote
   ```

## 无效尝试

- **Run git pull --rebase without checking for conflicts** — If conflicts exist, rebase will abort or create messy history; also may lose merge commits. (50% 失败率)
- **Use git push --force to override remote** — Dangerous on shared branches; may delete others' commits and cause data loss. (80% 失败率)
- **Ignore the hint and retry push without pulling** — Same error will occur because local is still behind remote. (100% 失败率)
