[Nfd-dev] Gerrit rebase a feature branch

Alex Afanasyev aa at CS.UCLA.EDU
Fri Sep 11 09:31:17 PDT 2015


> On Sep 11, 2015, at 6:25 AM, Davide Pesavento <davide.pesavento at lip6.fr> wrote:
> 
> Hi Junxiao,
> 
> I believe this is expected since commits C and D are not present on
> the (remote) branch you're pushing to. This is by design. If you
> cherry-pick commit B to the master branch, normally it only makes
> sense to push it to the master branch, not to the feature branch.
> 
> If you want to keep working on B on the feature branch, you should
> instead rebase the branch on top of the latest master, e.g.:
> 
> git checkout master
> git pull [origin master]  # get commits C and D
> git checkout the-feature-branch
> git rebase [--interactive] master
> git push origin HEAD:refs/for/the-feature-branch

This is correct, with the effect Junxiao mentioned: C and D will show up for the code review.

In any case, the solution involves merging C and D commits into the feature branch.  Using the code review process is one way, another way is directly merge those commits into the feature branch (aka, directly push to gerrit).   This can be done only if you have correct permissions (e.g., owner):

     git push origin gerrit/master:feature-lp

---
Alex

> 
> On Fri, Sep 11, 2015 at 1:58 PM, Junxiao Shi
> <shijunxiao at email.arizona.edu> wrote:
>> Dear folks
>> 
>> I have another question on git rebase.
>> 
>> Scenario:
>> 
>> 1. On Gerrit, a feature branch is created from master branch commit A.
>> 2. Change B is uploaded into the feature branch, whose parent is commit A.
>> It's not merged.
>> 3. In master branch, commits C and D are merged after A.
>> 4. I want to rebase Change B on top of commit D.
>> 
>> If I simply do a rebase or cherry-pick and execute `git push origin
>> HEAD:refs/for/the-feature-branch`, commits C and D would show up in the
>> review queue in the feature branch. (I didn't try recently but I saw this
>> happened before)
>> What should I do to rebase Change B without having to review C and D again?
>> 
>> Yours, Junxiao
>> 
>> 
>> _______________________________________________
>> Nfd-dev mailing list
>> Nfd-dev at lists.cs.ucla.edu
>> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev
>> 
> _______________________________________________
> Nfd-dev mailing list
> Nfd-dev at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20150911/d255a2bb/attachment.bin>


More information about the Nfd-dev mailing list