I do see other similar questions, but I dont really understand why this happens. For now, I am using git reset --hard HEAD
then manually adding back my changes. The suggested solution seems to be git pull origin master
? But I still get the same message after that. Whats wrong? How do I do a merge? I am still relatively new to GIT
$ git pull origin master
Nodester!
Enter passphrase for key '/home/jiewmeng/.ssh/id_rsa':
From nodester.com:/node/git/jiewmeng/10267-f62c0a21d1a9d75ab7b6ace5858921d0
* branch master -> FETCH_HEAD
Merge made by the 'recursive' strategy.
$ git branch -a
* master
remotes/origin/master
As mentioned in "Why is Git telling me “Your branch is ahead of 'origin/master' by 11 commits.” and how do I get it to stop?"
"your branch is ahead by..." => You need to push to the remote master.
Run "git diff origin/master
" to see what the differences are between your local repository and the remote master repository.
If you're ahead of the remote repo by one commit, it's the remote repo that's out of date, not you.
Pulling wouldn't help.
Now check also if you are actually on a branch (and not on a detached head).
This is your case here (you are indeed on master
branch)
"Branch is ahead by X commits" can have 2 reasons: 1) You have real local commits, and you will need to do 'git push' 2) Your 'origin' branch is out of syn with remote end. Do:
git fetch
(Root cause appears to be linked to doing 'git pull origin master' instead of 'git pull')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With