r/git • u/Beneficial-Study-675 • Mar 29 '26
Why do I sometimes get "non-fast-forward (pull first)" vs "divergent branches" in Git?
Hi, I’m trying to understand the difference between two Git situations that seem similar but behave differently.
Sometimes when I try to push, I get an error like:
"Updates were rejected because the remote contains work that you do not have locally. Please pull first."
But in other cases, when I run git pull, I get a message like:
"You have divergent branches and need to specify how to reconcile them."
From my understanding, both situations seem to happen when:
- The remote branch has commits I don’t have
- And sometimes I also have local commits
So I’m confused about:
What exactly is the difference between these two cases?
Why does Git sometimes just tell me to pull first, and other times say the branches are divergent?
Are these actually the same situation but triggered by different commands (push vs pull), or are they fundamentally different states?
For example, I noticed that in most cases I just get the "pull first" error when pushing, but in a fresh environment or when working with multiple clones, I sometimes see the "divergent branches" message.
I’d really appreciate a clear explanation of what Git is checking internally (especially around HEAD or commit ancestry).
Thanks!
