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:
- gerrit error: missing Change-Id in commit message footer
- How to cancel the commit, how to cancel the commit after git commit, and how to change the submitted content
- !!!! You must write Log Message,at least 5 characters. Commit aborted !!!!
- How to solve the problem of “please enter a commit message to explain why this merge is necessary” when git merges branches?
- Common solutions to errors in checkout or commit of SVN
- Change the path in the user directory in Chinese Ubuntu to English
- Solve “error: failed to commit transaction” in arch Linux
- How to Change Local Path in TFS
- Mybatis openSession.commit () manually submit data and openSession.commit (true) automatically submit data
- Error 1064 in MySQL password change
- Git commit encountered error: pathspec (Fixed)
- How do I change the default background color of all FIGURE objects created in MATLAB
- The COMMIT TRANSACTION request has no corresponding BEGIN
- Solutions to the problem of vulnerable missing firmware in Ubuntu
- Solution of fileuriexposedexception for Android 7.0 behavior change
- Error in installing pywin32 under Windows: close failed in file object D estructor:sys.excepthook is missing lost sys.stderr
- Missing parents in call to ‘print’
- pathspec commit did not match any files known to git
- Spring failed to commit the transaction
- An error occurred while loading commit signatures