Git Your branch is ahead of 'origin/master' by X commits费事不费心解决方法

Author: Bruce Liu Posted on: 2021-06-13 09:39:01 Visited: 216

现象描述:有时候混合使用git gerrit,代码已经push,但还提示ahead,再次提示又担心出现问题。

#git pull

Already up-to-date

#git status ./

On branch master

Your branch is ahead of 'origin/master' by X commits

 

解决方法:

1:将代码复制到另外一个地方进行备份。

2:进行代码回退,修改会丢失,git reset --hard HEAD~x

3:然后再次查看git status,如果Your branch is behind of 'origin/master' by X commits,使用git pull再次更新

3:用备份代码与当前代码比较,重新commit,重新push。

 

注:x换成具体的数值。




Tags:
git gerrit ahead behind reset

相关主题:

留言信息:

......期待您的留言!


增加留言、提问或者评论,不用注册,匿名提交,你提交的信息经过审核后才会显示:


© 2008-2022 CunYouLu存有录博客 村友录 存游录 鲁ICP备08005943号