解决git:Your branch is ahead of ‘XXX‘ by X commits

解决git:Your branch is ahead of 'XXX' by X commits

解决git:Your branch is ahead of ‘XXX‘ by X commits_第1张图片

 

On branch xxx
Your branch is ahead of 'xxx' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
 

明明2个commits已经提交,到代码仓库看,也确实已经提交成功。

 

解决方案,重置本地代码仓库和远程一致:

git reset --hard origin/xxx

 

 

git删除/撤销远已经push到程服务器上某次代码提交_git删除某次push_zhangphil的博客-CSDN博客git删除/撤销远已经push到程服务器上某次代码提交场景:不小心把一次错误的代码push到远程服务器上的分支上,需要立即删除/撤销这次代码提交。具体方法,git命令:git reset --hard git push origin HEAD --forcecommit_id可以通过git命令:git log输出获取。commit_id形如:126f206185f225879f2723ca421https://blog.csdn.net/zhangphil/article/details/79670257

 

你可能感兴趣的:(git,git)