最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can a `git pull` have divergent branches but then resolving it leaves nothing to push? - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 2

It'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.

发布评论

评论列表(0)

  1. 暂无评论