I want to push a single commit to Gerrit without affecting other commits in the same topic branch. Unfortunately I don't have a test instance of Gerrit to experiment with.
Scenario: I have contributed a topic branch to the project, which is in review, and other developers have updated parts of it. Now I wish to make changes on top of their updates.
To do this I pull the changes by the other developer in the commit I wish to edit, do an interactive rebase locally to make my own changes, then push to Gerrit, making sure the Change-Id is still the same. This adds a new version of the file to the patchset for review.
Problem: When I tried to push a single commit to Gerrit, the other commits in the topic-branch were also pushed, overwriting changes by other developers.
Here is the syntax I used:
git push gerrit 3089c9f56542461dce738a9aa17bb743ed36e038:refs/publish/master/my-topic-branch
I presume that the other commits in the topic-branch were also pushed because of dependencies created by Gerrit.
Would this approach work instead, leaving out the topic branch title?:
git push gerrit 3089c9f56542461dce738a9aa17bb743ed36e038:refs/publish/master
I tried this approach successfully previously, pushing to the specific changeset:
git push gerrit a95cc0dcd7a8fd3e70b1243aa466a96de08ae731:refs/changes/12345
However, in trying this again I am now getting an unpack error:
error: unpack failed: error Missing tree 9172313b907b160d15e260d5f7d51689f467b858
Related question: When I pull the other developers' changes from Gerrit, how can I make sure that I have pulled all the files contributed in the topic-branch? If I select the topmost change in Gerrit in the topic-branch, and use the pull command stated in the web ui, it seems that some of the files in the topic-branch are updated locally, but not all. Do I need to go through every single commit in the topic-branch and issue the relevant pull command?
I don't know the commands of hand but it would be something like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With