git pull
fails because You have divergent branches and need to specify how to reconcile them.
Fair enough, the local branch has had another branch merged onto it.
git pull --rebase
succeeds.
Then git push
says Everything up-to-date
.
How can there be divergent branches but then rebasing one of them on top of the other one leave nothing to push?
git pull
fails because You have divergent branches and need to specify how to reconcile them.
Fair enough, the local branch has had another branch merged onto it.
git pull --rebase
succeeds.
Then git push
says Everything up-to-date
.
How can there be divergent branches but then rebasing one of them on top of the other one leave nothing to push?
Share Improve this question asked Mar 12 at 9:52 TomTom 8,0425 gold badges48 silver badges89 bronze badges1 Answer
Reset to default 2It's possible that you had effectively "equal" commits – e.g. with identical content but different metadata, which can happen after git commit --amend
for example. When git rebase
reapplies your local commits on top of the new base, it will discard such duplicates.
(Or, possibly, the same effective "diff" but applied on different base resulting in a different commit ID, etc.)
If it happens again, 1) use gitk
or tig
to view both local and remote branches simultaneously to see in what way they diverge; 2) if they have seemingly the same commits, use git range-diff
to compare their effective diffs and metadata.
git range-diff main...origin/main
or git range-diff ...@{u}
to diff against your current upstream.