简体   繁体   中英

Use unreviewed changes on Gerrit as base

I have a commit A, B and C - all of which are on gerrit waiting for a code review (umerged).

For example A, B, C introduces the method

void method(param1, param2, param3)

which was before

void method(param1)

If I don't use commit A, B & C as a base. I am missing param2 and param3.

I need a way to use commit A, B and C as a dependency for commit D.

How would you go on about doing this?

Although it's not recommended, if really needed, you can base your change in an unmerged commit. All you need to do is to download the unmerged commit using the fetch+checkout command available at the "DOWNLOAD" section of the Gerrit UI, make your commit and push it to review on Gerrit.

But keep some things in mind:

1) You will not be able to merge (submit) your commit until the base commit is merged.

2) If the base commit change (new patchset) during the review process you'll need to rebase your commit using the "REBASE" button in the Gerrit UI or manually in your local repository if you have conflicts.

I do this often by using a tweaked version of the 'Checkout' link in the Gerrit Download menu.

You get something looking like this:

git fetch "ssh://username@gerrit:29418/repo" refs/changes/32/3772/1 && git checkout FETCH_HEAD

Change the checkout in the command to rebase , and you'll base whatever change you currently have on top of the change on Gerrit:

git fetch "ssh://username@gerrit:29418/repo" refs/changes/32/3772/1 && git rebase FETCH_HEAD

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM