git
branch_error
ai_generated
true
Your branch and 'origin/main' have diverged
ID: git/diverged-branches
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Local and remote have different commits. Need to reconcile before pushing.
genericWorkarounds
-
92% success Pull with rebase: git pull --rebase origin main
git pull --rebase origin main
Sources: https://git-scm.com/docs/git-pull#Documentation/git-pull.txt---rebase
-
88% success Or merge: git pull origin main (creates a merge commit)
git pull origin main (creates a merge commit)
Sources: https://git-scm.com/docs/git-pull
-
85% success For feature branches, rebase onto main: git rebase main
git rebase main
Sources: https://git-scm.com/docs/git-rebase
Dead Ends
Common approaches that don't work:
-
Force push to override remote
85% fail
Destroys remote commits — other collaborators will lose work
-
Delete local branch and re-checkout from remote
80% fail
Loses all local commits that haven't been pushed
Error Chain
Frequently confused with: