[Nfd-dev] Gerrit rebase a feature branch

Davide Pesavento davide.pesavento at lip6.fr
Fri Sep 11 06:25:42 PDT 2015


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

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
>



More information about the Nfd-dev mailing list