ERROR: commit 60acc70: missing Change-Id in message footer

当合并commit时不小心删除了Change-Id,导致push失败。解决方案包括使用git commit --amend自动插入Change-Id,或使用git reset回退到特定commit后再amend。确保在编辑器中保存并退出,然后重新commit和push。如果需要撤销之前的commit,可以使用git reset命令,重新提交并添加Change-Id。
摘要由CSDN通过智能技术生成

我在合并多次commit的时候,不小心删除Change-Id,导致push失败

remote: Processing changes: refs: 1        
remote: Processing changes: refs: 1, done            
remote: ERROR: commit 60acc70: missing Change-Id in message footer        
remote: 
remote: Hint: to automatically insert a Change-Id, install the hook:        
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 xxxx@xx.xxx.xxx.xxx:hooks/commit-msg ${gitdir}/hooks/        
remote: and then amend the commit:        
remote:   git commit --amend --no-edit        
remote: Finally, push your changes again        
remote: 
error: failed to push some refs to 'ssh://xxxx@xx.xxx.xxx.xxx/project'

解决方法:

1.使用 amend 选项生成 Change-Id:

如果缺失 Change-Id 的是最后一个 (head) commit, 使用以下命令即可解决问题:

$ git commit --amend
该命令会打开默认的 commit message 编辑器,一般是 vi.

这时什么都不用修改,直接保存退出即可 (:wq).

再次查看 git log,就会发现缺失的 Change-Id 已经被补上了. 再次 git push 即可.

2. reset 方法

reset 命令撤销你的commit到工作区,你就可以重新提交了

如果缺失 Change-Id 的 commit 是 git log 中的第二个 commit, 则可以用 git reset 命令将本地分支回退到该 commit.

首先执行 git log, 找出缺失了 Change-Id 的 commit,并复制其 commit-id:

发现是第二个 commit 缺失 Change-Id. 将代码 reset 到这个 commit, 并执行 amend:

$ git reset 1a9096a34322885ac101175ddcac7dab4c52665d
$ git commit --amend

下一步是把 git reset 撤消掉的代码重新 commit, 然后 push 即可:

$ git add ......
$ git commit -m "你的提交日志"
$ git push review HEAD:refs /for/master
 

参考链接:https://blog.csdn.net/liuxu0703/article/details/54343096

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值