Reputation: 2493
I did a git fetch origin master
and then git pull origin master
and after this two commands when I do a git status
I get:
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
#
nothing to commit, working directory clean
Finding this strange (since I now my local was behind origin/master
) I cloned the repository again to other location and got it correctly, so remote repo is ok. Doing the git fetch
command first I updated my local origin/master with the online repository right? Than the git pull
was supposed to fetch again and then merge but I guess it didn't, don't know why. Can anyone please explain?
Thank you!
[EDIT]
I'm even more confused. Now I'm working on my original machine and just did git pull origin master
. For my surprise, the same thing occurred again. I used the git reflog --all
suggested and the one commit I did on the other machine doesn't show. This commit appears as if I have committed on this machine (so shows the ahead of ...
message again). Down follows what just happened, copy/pasted from the terminal window (just some personal information omitted).
user@user:~/my_project$ git pull origin master
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From my_git_site:my_repo
* branch master -> FETCH_HEAD
Updating some_bizarre_number
Fast-forward
main.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
user@user:~/my_project$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
Upvotes: 0
Views: 198
Reputation: 334
Try git reflog --all and see what are your last 5 commits. Maybe this will clarify where those commits are coming from.
Upvotes: 0
Reputation: 9959
The message means that there are five commits in your local master that you haven't pushed to origin/master. The pull will have merged your commits with the new commits from origin/master and committed the result locally, and evidently there were no conflicts or it would have asked you to resolve them.
If you look at your local revision history you'll see your commits and the remote commits and a new commit which merges them together and is your current HEAD.
Upvotes: 2