(1)方法1:git fetch origin
(2)方法2(代码还需要):git push origin
(3)方法3 (代码不需要):git reset --hard origin/$branch
参考:
https://blog.csdn.net/Thousa_Ho/article/details/73350703
https://stackoverflow.com/questions/16288176/your-branch-is-ahead-of-origin-master-by-3-commits
可以先执行下git diff $branch origin/$branch 看下差异
【备注,先git log 看看还有没有没有push 的commit的,如果没有,就用git reset --hard origin/$branch强制覆盖成和远程仓库一样,如果有的话,就先push】
(4) git pull --rebase
(5)git pull origin cherryPick
参考:https://blog.csdn.net/u010383937/article/details/72901675