DISCLAIMER : There's already a post that already addresses this issue but sadly the author did not find any definite answer.
Here's my issue : git pull
shows "already-up-to-date" but they're wrong
👉 For a quick 2-min video explaining the issue just here.
👉 For written explanation, read below.
Here's the sequence of events :
main
and F01
git push
the commits to gitHuborigin/main
and origin/F01
git pull
: ❌ "Already up to date"I already tried:
git fetch
: ❌ nothing.git diff main..origin/main
: ❌ nothing, no changes detectedgit diff main..F01
: there are changes ✅git diff main..origin/F01
: there are changes ✅Any ideas as to why origin/main can't be updated and sync with the real state of origin/main?
With the help of a mate who advised me to use gitHub Desktop, I've found the possible reason of the issue :
Instead of having main or origin/main as my default branch, for some reason (some command I may have accidentally performed), the F02 became the default branch. And I must have created F02 from origin/main. So I suppose @Nikhil was probably right.
Which was very weird because when performing a git branch
I could only see the following (and no F02 available) :
Solution I've found:
I've locally merged local/F01
-> local/main
and right after that I tried to git reset --hard to remove all the commits I had just added.
As a result : when doing git diff main..origin/main
, now it worked! ✅
I could see the changes on origin/main
that were not on local/main
:)
So I went back to my post to update my post and share my investigation and solution and found your two posts @larsks and @Nikhil.
@Nikhil : sadly I saw your post only after but I bet it would have made it worked cause it looks like the HEAD was detached from main
or origin/main
@larsks : I had already performed your command and indeed : F01
did show changes ✅ but main/origin did not show any new commits 😳 (for some reason).
Thank you very much for your help guys and for responding so quickly!