Git: Branch is ahead by X commits. Doesn't help doing git pull

后端 未结 4 1737
无人及你
无人及你 2021-01-03 03:16

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.

4条回答
  •  死守一世寂寞
    2021-01-03 03:38

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

提交回复
热议问题