I have a repository set up on GitHub that I have set up to use to sync code between two PCs (home and work). Today I encountered a strange problem.
When I do a git fetch origin
followed by git merge master
, I get the message Already up-to date
. That means both my local copy and the remote branch are mirror images, right? But the problem is some of the files are different in the two repositories, and it bothers me that there's nothing to commit (basically the remote repo is newer). To test it, when I did a git push origin master
I get an error saying Updates were rejected because the tip of your current branch is behind
.
The latter case is as it should be, but why am I not able to fetch those changes? Please note that I haven't tried git pull
because I hear it's bad practice.
======== UPDATE ======
The output of git remote show origin
is as follows (my remote is named as todoparrot):
* remote todoparrot
Fetch URL: https://github.com/ankush981/todoparrot.git
Push URL: https://github.com/ankush981/todoparrot.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (local out of date)