使用gerrit后,提交代码会出现如下截图问题:

临时解决:

step1:把上面红色的那条gitidir复制下来执行下:

step2:执行下面的命令会添加change_id

  git commit --amend

step3:然后推送代码到服务器上

  git push origin HEAD:refs/for/$branch_name

上面这个情况主要针对本地刚下载的仓库第一次提交会出现这个情况,只需要执行一次,以后再该仓库提交就不用执行了,说白了就是这个commit-msg是局部的,只对当前仓库生效。

还有另外一种情况,也是大家遇到比较多的,就是执行了上面的命令,再push时还是一样的错,这个时候,你就要检查下是否其他提交没有change_id,因为gerrit要求每个提交都要有change_id。

举例:

执行git log 看到类似如下现象:

从上而下,我们用commitid1,commitid2,commitid3表示截图中的三个提交,很明显,第二个提交commitid2没有change_id,这个时候我们可以git reset --soft commitid3来软回退到异常节点的前一个正常的节点,这个操作相当于撤销了最后的git commit -s的操作,add过的代码还在索引库(可以去了解下git reset --soft),具体操作如下:

(1) git reset --soft commitid3

(2) git status 可以看到绿色的已经add过的文件(即commitid1和commitid2的改动)

(3) git commit -s #添加评论,保存退出后会生成change_id

(4) git log 可以看到已经有了change_id

(5) git push origin HEAD:refs/for/工作分支

我的具体操作如下,供参考:

参考:

https://blog.csdn.net/u012843873/article/details/82424514

该博客中还介绍了第三种方式使用交互式 rebase 找回任意提交位置的 Change-Id ,git rebase -i commitid3,然后参考如下:

其中还介绍了change-ID相关信息,钩子之类的,详细内容见参考链接。

git push 报错:missing Change-Id in commit message footer的更多相关文章

  1. git push报错大文件,删除后重新commit依然报错

    git push报错: github不能上传大文件,按道理删掉重新提交就行了 可是删掉后,git add -A,再git commit,再git push,依然报错 后来我想明白了 github上传时 ...

  2. git push报错error: failed to push some refs to 'git@github.com'

    git push报错error: failed to push some refs to 'git@github.com' $ git push -u origin master To git@git ...

  3. git push 报错

    git push报错误: Git push error: RPC failed; result=56, HTTP code = 200 fatal: The remote end hung up un ...

  4. 电脑修改密码后,git push 报错unable to access

    电脑修改密码后,git push 时报错 remote: Permission to xxx A. fatal: unable to access  解决这个问题有两种方法,一种是界面修改,一种是命令 ...

  5. git push 报错 "Peer certificate cannot be authenticated with known CA certificates"

    使用git push -u origin master 命令向远程仓库提交代码时报错:Peer certificate cannot be authenticated with known CA ce ...

  6. 解决git push报错error: failed to push some refs to 的问题

    这个问题发生的背景一般是: 想把自己本地的某个项目关联到远程仓库并推送上去,接着他会做如下操作: 本地项目->远程创建仓库->本地关联远程->推送最新代码 最后一个步骤发生问题: 那 ...

  7. git push 报错:failed to push some refs to 'git@git.xxxx:devops/thor.git'

    error: failed to push some refs to 'git@git.caicaivip.com:devops/thor.git' hint: Updates were reject ...

  8. git push报错

    git: No refs in common and none specified; doing no (2012-10-28 11:43:10) 转载▼ 标签: 杂谈 分类: 项目管理 用gitol ...

  9. 由于github仓库中提前建立readme文件,导致git push报错error: failed to push some refs to 'git@github.com:

    $ git push -u origin master To git@github.com:xxx/xxx.git ! [rejected] master -> master (fetch fi ...

随机推荐

  1. 9.24 Django Form组件

    2018-9-23 20:10:04 这两天优化了自己图书管理系统 github 连接:https://github.com/TrueNewBee/pythonDemo 顺便整理了博客,写了好多总结, ...

  2. day_4_24 py

    ''' 函数的嵌套调用应用 ''' # def print_line(): # print("="*50) # def print_5_line(): # i = 0 # whil ...

  3. linux升级内核

  4. centos7 安装redis服务及phpredis扩展

    闲话少说 服务器版本:centos7.6 64位 软件包:https://pan.baidu.com/s/1Gb4iz5mqLqNVWvvZdBiOMQ 提取码: xrhx 一.安装redis 放在/ ...

  5. Quartz任务调度实践

    最近在写一个任务调度程序,需要每隔几秒查询数据库,并取出数据做一些处理操作.使用到了Quartz任务调度框架. 基本概念 Quartz包含几个重要的对象,分别为任务(Job),触发器(Trigger) ...

  6. 170829、mybatis使用oracle和mybatis中批量更新

    一.mybatis执行批量更新batch update 的方法(mysql数据库) 1.数据库连接必须配置:&allowMultiQueries=true(切记一定要加上这个属性,否则会有问题 ...

  7. CodeForces 1056E - Check Transcription - [字符串hash]

    题目链接:https://codeforces.com/problemset/problem/1056/E One of Arkady's friends works at a huge radio ...

  8. nginx伪静态之try_files和rewrite讲解

    服务器脚本以php为例     一.伪静态是个啥?   1.说起伪静态基本上搞web开发的人,多多少少都有了解与使用,有人会说什么时候会使用伪静态?使用原生的url地址不是蛮好的吗,确实是这样的,其实 ...

  9. Laravel 5.2 INSTALL- node's npm and ruby's bundler.

    https://getcomposer.org/doc/00-intro.md Introduction# Composer is a tool for dependency management i ...

  10. Linux下稀疏文件的存储方式

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...