solving your branch is ahead problem
If you are using a public repository and have messages where your branch is ahead of 'origin/master' by xx commits, this can be because someone has done a rebase or reset –hard on that branch, thus removing commits. Even a git pull will not update your branch. You can make your branch match the remote like this (substitute master with your branch name if necessary):
git reset --hard origin/master HEAD is now at blah blah