Reputation: 55
My patch on Gerrit needs to be merged, but there is an error of "ANCESTOR OUTDATED". This is because the commit that my patch depends on has been outdated/abandoned, and replaced with a new merged commit.
I thought that I could simply do git rebase -i HEAD~2
and edit the dependency. By editing the dependency, I mean that once I rebased onto the dependency commit (1 commit behind HEAD), I could cherrypick the new changes there.
However, I get a long error message:
interactive rebase in progress; onto SHA#
Last command done (1 command done):
edit *** DEPENDENCY
Next command to do (1 remaining command):
pick *** MY PATCH
You are currently rebasing branch 'temp' on 'SHA#'.
nothing to commit, working directory clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git reset'
How can I simply update the commit that is right behind my HEAD and then solve this ANCESTOR OUTDATED issue on Gerrit?
Edit: The reason why I can't do this rebasing quickly with Gerrit's "Rebase Change" button is because it says that there are merge conflicts and it cannot due it automatically.
Upvotes: 0
Views: 994
Reputation: 55
My solution (must be done in the working directory of your project):
--> This pretty much fixes your branches outdated commit history and puts your patch correctly at the tip.
Upvotes: 0
Reputation: 810
I would recommend you:
*I'm considering you commit has a gerrit's Change-Id; if doesn't, you should do a regular commit to create it (the commit-msg hook is responsible by that).
Also, when I say push, I'm referring to gerrit's approach (which is a git push origin HEAD:refs/for/master
not simply git push
).
Upvotes: 1