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

When merging multiple commits, I accidentally deleted the Change-Id, resulting in push failure

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 [email protected]: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://[email protected]/project'

Solution:

1. Use the amend option to generate a Change-Id:
If the missing Change-Id is the last (head) commit, use the following command to fix it:

$ git commit –amend
This command will open the default commit message editor, usually vi.

At this point, you don’t need to change anything, just save and exit (:wq).

If you check the git log again, you will see that the missing Change-Id has been filled in. Just git push again.

2. reset method
The reset command undoes your commit to the workspace, and you can recommit

If the missing Change-Id commit is the second commit in your git log, you can use the git reset command to roll back your local branch to that commit.

First, run git log, find the commit with the missing Change-Id, and copy its commit-id:

Find the second commit that is missing the Change-Id. Reset the code to that commit, and execute amend:

$ git reset 1a9096a34322885ac101175ddcac7dab4c52665d
$ git commit --amend

The next step is to recommit the code that was undone by git reset, and then push it:

$ git add ......
$ git commit -m "The log you Submitted"
$ git push review HEAD:refs /for/master
 

Reference link: https://blog.csdn.net/liuxu0703/article/details/54343096

Read More: