Andrew Andrew - 1 month ago 14
Git Question

Rebase remote branch onto master while keeping the remote branch updated

I am trying to rebase my remote branch onto master, but I want to keep the remote branch pointing to it's commits, just based at a different point in master.

Here is my structure:

A - B - C - D (origin/master)
\
R - S - T (origin/develop)


I would like:

A - B - C - D (origin/master) - R - S - T (origin/develop)


Is such a rebase possible without some sort of merge?

Answer

In your context, you will do

git rebase origin/master    
git rebase origin/master origin/develop

Official reference: At the beginning

      A---B---C topic
     /
D---E---F---G master

after do

git rebase master
git rebase master topic

we have

              A'--B'--C' topic
             /
D---E---F---G master

(Source: https://git-scm.com/docs/git-rebase)