Reputation: 596
I'm trying to push the newest Git-Commit to gerrit. But somehow I get an error message saying that I can't push, because two commits have the same Change-ID.
In the image below you can see the current situation.
So my idea to fix this problem would be to delete the second commit. Is this possible?
Upvotes: 1
Views: 437
Reputation: 30858
Suppose the commit hashes of the three commits from top to bottom are A, B and C.
Make sure git status
tells it's clean. If not, run git stash
first.
If you really don't want B any more,
git reset C --hard
git cherry-pick A
If you still want B,
git reset B --hard
git commit --amend
# Edit the commit message and delete the change-id line, save and exit.
# The commit-msg hook will generate a new changeid.
git cherry-pick A
And then push again.
Upvotes: 3