首页 > 其他分享 >Git push到gerrit时报错change xxx closed

Git push到gerrit时报错change xxx closed

时间:2023-11-13 15:00:59浏览次数:31  
标签:Git xxx gerrit git 报错 closed commit Id change

Git push到gerrit时报错change xxx closed

报错日志:

To ssh://xxxx
 ! [remote rejected] HEAD -> refs/for/master (change http://xxxxm/+/96107 closed)

可以看到这个提交已经closed了,而change-Id未更改。

即使用了已经合入的change-Id,在一次push 的时候远端判断此change-Id 已经使用,所以报错。

所以需要更新commit的change-Id。

有两种办法:

  1. 如果对应的commit就是第一个,直接

    git commit --amend
    

    然后删除change-Id一行:

     Change-Id: I1bd9517834af01ebb372be25de74444aadbe6fb3
    

    保存并退出编辑页面,git会自动生成新的change-Id。

  2. 如果对应的commit不是最新的第一个提交,则用git rebase解决,找到第几个提交报错(示例为第145个提交)

    git rebase -i HEAD~145
    

    然后结合rebase的工具提示:

    # Rebase 08d9cc6..7fce9cd onto 08d9cc6 (145 command(s))
    #
    # Commands:
    # p, pick = use commit
    # r, reword = use commit, but edit the commit message
    # e, edit = use commit, but stop for amending
    # s, squash = use commit, but meld into previous commit
    # f, fixup = like "squash", but discard this commit's log message
    # x, exec = run command (the rest of the line) using shell
    # d, drop = remove commit
    #
    # These lines can be re-ordered; they are executed from top to bottom.
    #
    # If you remove a line here THAT COMMIT WILL BE LOST.
    #
    # However, if you remove everything, the rebase will be aborted.
    #
    # Note that empty commits are commented out
    

    将报错的commit前的pick,修改为r,即“使用commit,但是需要编辑commit信息”,同样删除change-Id一行,保存并退出编辑页面,同样,由git自动生成新的change-Id即可。

标签:Git,xxx,gerrit,git,报错,closed,commit,Id,change
From: https://www.cnblogs.com/adam-zheng/p/17829102.html

相关文章

  • Centos7 nginx反向代理gitea和grafana&钉钉告警
    1安装nginxyuminstall-ygccmakepcre-develzlib-developenssl-develwgethttps://nginx.org/download/nginx-1.20.1.tar.gztar-zxvfnginx-1.20.1.tar.gzcdnginx-1.20.1./configure--prefix=/usr/local/nginx--with-http_ssl_modulemakemakeinstallvi/etc/system......
  • Git常用命令
    1、基本配置配置提交人姓名:gitconfig--globaluser.name提交人姓名配置提交人邮箱:gitconfig--globaluser.email提交人邮箱查看git配置信息:gitconfig--list2、提交及拉取提交:gitpush拉取:gitpull3.删除本地分支gitbranch-d<branch_name>4、如果想要......
  • 【已解决】git push send-pack: unexpected disconnect while reading sideband packe
    解决办法:修改缓存大小打开项目所在路径下的git目录找到config文件,用记事本打开编辑。添加如下内容并保存即可[http]postBuffer=1048576000......
  • 如何在提交前查看 Git 中的文件差异。
    内容来自DOChttps://q.houxu6.top/?s=如何在提交前查看Git中的文件差异。这种情况经常发生在我身上:我在一两天的时间里同时进行几个相关变更,当要提交时,我常常会忘记在特定文件中有哪些改动。(这只是一个个人的git仓库,所以我不介意在一次提交中包含多个更新。)是否有办法......
  • git--从ysyx中吸取经验教训
    起因:当时是在做ysyx中红白模拟机部分运行脚本执行不成功报错报了两处一个是断言错误一个是makefile里的一个image的变量后面在进行答疑会由同学和助教指出是因为分支的错误我也从来没想过这个错误并且过程中debug时候对于git指令显得尤其不熟悉下面大概总结了比较经典的......
  • GitHub-fatal-unable-to-access-https-github-com-Failed-to-connect-to-github-com-p
    title:>-[GitHub]fatal:unabletoaccess'https://github.com/':Failedtoconnecttogithub.comport443:Operationtimedouttags:[github,git]categories:githubdate:2021-11-2311:11:002021年11月,由于众所周知的缘故,连接到github越来越微妙,分享一些MAC......
  • git基本操作
    git提交相关命令#初始化仓库gitinit#将文件添加到暂存区gitadd.#提交到版本控制gitcommit-m""#推送到远程服务器gitpush#从远程服务期更新代码到本地gitpull#查看git状态gitstatusgit其他命令#克隆仓库gitclone#查看远程仓库相关信息gitremote#......
  • git pull failure
    https://www.cnblogs.com/python924/p/12800200.htmlhttps://blog.csdn.net/sinat_34937826/article/details/107316884......
  • Github项目README美化 | Github徽章制作
    Github项目README美化|Github徽章制作1、前言平时逛Github开源项目的时候,经常看到README文件会有各式各样的小徽章,哈哈,你是不是也想在自己的项目上添加Github小徽章。让我们来看看别人的项目徽章。VueReact无疑,这样的Github徽章能合理的优化README的美化,能够更加地吸引别......
  • 解决:tcpdump -w xxxxx.cap 提示 Permission denied
    出现的如题所示问题。经过多次调试查找资料,找到了一种好用的方法。解决方案1:我们只需进入/tmp所在的目录下,然后执行tcpdump命令即可解决。例如:解决方案2:将文件写入指定目录下,正常是可以利用参数-w将采集的文件写入指定的文件目录下,但是往往会出现如上图所示的错误。这时......