you have divergent branches and need to specify how to reconcile them.
You’re seeing the Git message:
“You have divergent branches and need to specify how to reconcile them.”
This usually appears when you run git pull, and your local branch and the
remote branch have both made different commits since they last shared a
common history, so Git needs you to choose how to combine them.
What the message really means
In plain terms:
- The remote branch (for example
origin/main) has new commits. - Your local
mainalso has commits that are not on the remote. - Git can’t just “fast‑forward” (move your branch pointer ahead) because that would throw away or ignore one side’s work.
- So it asks you to choose a strategy:
- Merge : keep both histories, add a merge commit.
- Rebase : replay your local commits on top of the remote history, giving a linear history.
Quick fixes: three main strategies
All of the following assume you are on the branch that shows the error (for
example main).
1. One‑off solution with merge
This is the safest if you’re unsure and want to preserve history exactly as it happened.
-
Make sure your work is committed (or stashed).
-
Run:
bash git pull --merge -
If there are conflicts:
-
Open the conflicted files.
-
Fix the conflict markers.
-
Then:
bash git add . git commit
-
This creates a merge commit combining local and remote changes.
2. One‑off solution with rebase (cleaner history)
Use this if you want a linear history and are comfortable with rebasing.
-
Again, commit or stash your work.
-
Run:
bash git pull --rebase -
For conflicts:
-
Fix conflicts in files.
-
Then for each conflict round:
bash git add . git rebase --continue
-
Your local commits are replayed on top of the updated remote branch, which keeps history tidy.
3. Set a default “reconciliation” method (stop the message permanently)
Git introduced this hint so you explicitly set how you want git pull to
behave going forward.
Pick one of these global settings:
-
Always merge on pull:
bash git config --global pull.rebase false -
Always rebase on pull:
bash git config --global pull.rebase true -
Or only allow fast‑forwards (no merges or rebases, pull fails if history diverged):
bash git config --global pull.ff only
After you set one, a plain git pull will use that behavior and the “need to
specify how to reconcile them” message will stop appearing.
You can also set it per‑repository (without --global) if different projects
want different rules:
bash
git config pull.rebase true
If you’re using a GUI (GitHub Desktop, Sourcetree, Visual Studio)
Many people hit this error in GUIs like GitHub Desktop or Sourcetree and get confused.
- GitHub Desktop :
- You may need to open a terminal from the app and run the
git configcommands above so the underlying Git knows what to do. - After that, the GUI’s normal “Fetch origin” / “Pull” buttons should work without the hint.
- You may need to open a terminal from the app and run the
- Sourcetree / other GUIs :
- Look for settings related to:
- “Pull” strategy,
- “Rebase instead of merge”,
- “Fast‑forward only”.
- Configure them to match the behavior you want (merge or rebase); the GUI will then call
git pullwith those options behind the scenes.
- Look for settings related to:
Minimal, safe workflow example
A typical, safe daily flow using rebase to keep things clean:
-
Update your branch:
bash git pull --rebase -
Work and commit:
bash git add . git commit -m "Describe change" -
Push:
bash git push
Once you’re comfortable with that, set:
bash
git config --global pull.rebase true
Then you can just use git pull and it will behave the same way.
Why Git started nagging you “suddenly”
Recent Git versions made git pull more explicit: instead of silently picking
a strategy, they now require you to choose how to reconcile divergent
branches once and for all through configuration. So even if your workflow
didn’t change, the tool’s defaults did.
TL;DR: the one command most people want
If you like a clean linear history and are okay with rebase, run this once:
bash
git config --global pull.rebase true
Then, next time you see the hint, just do:
bash
git pull
Your local commits will be rebased on top of the remote, and the message should disappear for good.
Information gathered from public forums or data available on the internet and portrayed here.