Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull says it's up to date but it isnt

Tags:

I have some changes I made from another computer and sent it to remote repository.
When I try to make a git pull origin <branch> from home to get those changes it
says Already up-to-date but the changes are not in my computer, the files have not changed.

Why?

Edit 01:

When I try git log

commit 10ewwqe9989861ad33335e40188dcab598bc2312 Author: Name
Date: Sun Nov 27 23:46:40 2016 -0200
< commit message here >

If I check this commit code/name on bitbucket commits section, I see that THIS commit is one behind than the last commit present in my remote repository.

Edit 02:

>$ git remote -v

origin  https://bitbucket.org/username/repositoryName (fetch)  
origin  https://bitbucket.org/username/repositoryName (push)    

>$ git fetch origin

From https://bitbucket.org/username/repositoryName
 * [new branch]      myBranch -> origin/myBranch  

>$ git log myBranch..origin/myBranch

commit 0220ff...
Author: John Doe <[email protected]>
Date:   Mon Dec 28 16:43:07 2016 -0200

    Name of my last update to remote repository  

The log command shows the right last commit, the last one that is in my remote repository and the one I want to bring to my local files... But local files still unchanged.

like image 943
PlayHardGoPro Avatar asked Feb 02 '17 13:02

PlayHardGoPro


People also ask

Why does git status says up-to-date but not?

This status message is OK. We are up-to-date, there is nothing to commit, but there is still an untracked file. Since this file should not belong in git, this status shows a good git repo with all updates available to the instructor and the partner.

Why does git pull says already up-to-date?

The message “Already up-to-date” means that all the changes from the branch you're trying to merge have already been merged to the branch you're currently on. More specifically it means that the branch you're trying to merge is a parent of your current branch.

Why git pull is not working?

Not enough information for Git to work with As the error message states: you will have to let Git know what remote branch it should use to track with the current local branch. Doing this will allow you to simply run git pull and Git will know where to bring new data from.

How do I force git pull?

Forcing Git Pull The key command to force a git pull from a remote repository is git reset --hard origin/master . The other commands are to ensure you don't lose any data, by making a backup! First, git fetch --all syncs up our remote to our local.


1 Answers

Assuming you did git pull origin myBranch already and it didn't work and since you know the most up-to-date commit, you can simply point your branch to that commit (in this case 0220ff): git reset 0220ff. Now run git log to verify that you're at the right commit. As VonC also mentioned, you could do create a branch pointing to the remote myBranch git checkout -B myBranch origin/myBranch but I suspect that if the git pull origin myBranch didn't recognize the latest change in origin/myBranch, then this might not work either.

I'm still not sure why git pull origin myBranch wouldn't work, but it seems like your local machine is aware of the latest change on origin/myBranch, so it should theoretically have 0220ff in its local object store ready for you to point your branch to this location.

like image 142
jbu Avatar answered Sep 22 '22 09:09

jbu