gerrit提交代码到远程分支失败(you are not allowed to upload merges)

最近使用gerrit作codereview,在本地进行了三次提交,最后想push到远程仓库,出现提交错误

you are not allowed to upload merges,后面查了说是grerrit一个bug,也不知道算不算bug,就是多次提交后再提交到gerrit作代码

review就会有问题。解决办法就是恢复到自己提交修改前版本,然后整体合并一次提交,步骤如下:

1、git log 查看之前版本hash值

2、git reset --soft 0b598e0b7db78d343d63a85eb9fe781a4335cd49 (注意要--soft参数不然本地修改的代码也没有了)

3、git pull --rebase

如果遇到如下错误

error: cannot pull with rebase: You have unstaged changes.
error: additionally, your index contains uncommitted changes.
error: please commit or stash them.
需要转移分支修改过代码,使用

git stash

git pull --rebase

git stash pop

后面步骤和正常提交流程一样,git add -> git commit  -> git push

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值