Reputation: 846
I am facing this issue in Gerrit, Git.
What I tried --
After reading through internet of possible solutions, I did HARD reset and my changes of changeId-241 got vanished. I though got it back from reflog. But moment, when I try to checkOut branch-ONE (to do HARD Reset), my changes of changeId-241 is vanished.
I am trying to follow this - Git merge pending due to an abandoned commit
Upvotes: 1
Views: 1626
Reputation: 8310
If you want to push both the changes for review, then either restore the abandoned change and try to push again or using the rebase command with interactive option (git rebase -i HEAD~2) update the commit message of abandoned change, remove the "Change ID" line from commit message so that gerrit will not try to upload a new patchset to abandoned change rather it will upload new change.
If you want to upload only latest commit then using same rebase command remove the abandoned change from your local repo.
git rebase -i HEAD~2
Upvotes: 0
Reputation: 22411
It's impossible to know for sure what you have done but it seems you have something like this:
BASE --- COMMIT-1 <= branch-1
\
\--- COMMIT-2 <= branch-2
The COMMIT-2 on branch-2 depends on COMMIT-1 on branch-1 so when you push COMMIT-2 to Gerrit automatically you also push COMMIT-1. Gerrit will reject COMMIT-1 because change 240 is abandoned.
You should have worked in parallel instead, like this:
BASE --- COMMIT-1 <= branch-1
\
\--- COMMIT-2 <= branch-2
This way the COMMIT-2 wouldn't depend on COMMIT-1 so you could amend the commits as you need and submit/abandon their changes in Gerrit as you wanted.
Upvotes: 1