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.
"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')