3

I created a branch using Bitbucket cloud. Then I went to my two laptops and ran git fetch and git checkout new-branch. I can successfully see the new branch.

On laptop A, I make some changes commit them then I push them to the origin using following commands

git add .
git commit -m 'some message'
git push -u origin new-branch

I can see them under commits on bitbucket.org.

Then when I go to Laptop B and run git fetch says up to date. run git pull. Says already up to date. I cannot pull down the latest commits from the branch.

Go back to bitbucket.org and the commits are still listed there. If I create a new branch then go and fetch it on Laptop B using git fetch then if I run git pull on that old branch it will now return the commits I was missing.

Has anyone had this happen before.

Alex Clark
  • 213
  • 2
  • 4
  • 11
  • Can you please post the exactly commands that you are using in order to check what could be wrong? – Dazak Apr 26 '18 at 03:10
  • @Dazak I formatted my post better to highlight the commands. Let me know if there is anything else I can clarify. – Alex Clark Apr 26 '18 at 03:49
  • try in Laptop B run `git fetch --all`, then `git pull origin new-branch` – Dazak Apr 26 '18 at 04:39
  • I ran both. `git fetch --all` just returned `fetching origin`. Then `git pull origin new-branch` just returned `Already up to date`. When i double checked what each branch was pointing to using `git branch -avv` and it still showed the old commit as the one the remote was pointing to. – Alex Clark Apr 26 '18 at 11:44

1 Answers1

0

Sounds like your two working directories may be pointing to different remotes. Run this command on both and carefully compare the outputs:

$ git remote -vv

Assuming those are identical, the next thing to check is git status on each. It's possible that one of your working directory HEADs is in a "weird" state, and git status may tell you how to fix that (for example if you abandoned a rebase operation without running git rebase --abort).

user28731
  • 188
  • 5