Gerrit submit change after abandoning its parent
Asked Answered
W

2

5

I have a situation where I have pushed changeA and changeB to Gerrit. changeA is the parent of changeB.

changeA was abandoned. Will changeB will automatically be merged if its approved? If yes, what would its parent be?

If changeB will not automatically be merged, what do I need to do to have it merge properly?

Weekday answered 3/9, 2014 at 23:1 Comment(3)
The terminology you use is weird. I assume you're talking about changes and not patch sets. Patch sets are commits connected to the same change. They are not abandoned; changes are abandoned. Patch set 1 of change A can't be the parent of patch set 2 of change A, but patch set 1 in change A can be the parent of patch set 1 in change B.Compromise
I would avoid such cases when a change2 is a child of change1 which is not yet submitted. so first review change1 then start working on change2 - but anyway this scenario can occur.Granddad
@MagnusBäck: Thanks, I have clarified it. I am talking about 2 different changes and not patchsets.Weekday
L
9

From the Gerrit UI, just abandon ChangeA, then rebase ChangeB and select the checkbox for "Change parent revision". This updates the parent of ChangeB to the current branch tip.

Lincoln answered 11/7, 2018 at 12:37 Comment(0)
B
0

There is a few options and it depends if you want to include the changes of patchset-1.

  1. You only want the changes from patchset-2? Checkout master and cherry-pick patchset-2, commit -amend and push again
  2. You want to include changes from patchset-1 and 2? In this case you may want to combine the two patchsets, easiest is to do a git reset HEAD~2 and commit again, don't forget to copy the Change-ID of your last commit to be able to continue that review
Beatriz answered 4/9, 2014 at 2:33 Comment(2)
I have edited my question. I am referring to two different changes and not patchsets. Does your solution still apply?Weekday
Yes, I guessed what you meant. It applies to changes and not really patchsets. So yes, it applies to changes.Beatriz

© 2022 - 2024 — McMap. All rights reserved.