# rebase question

2 messages from 2011-03-11 to 2011-03-13. Participants: Ryan Sun, Martin von Zweigbergk.
Thread: https://gitlist.dev/t/26717

## Ryan Sun, 2011-03-11 19:57

Subject: rebase question
Message-ID: <AANLkTi=8Q+gNSY2jzgMMtPX-JHUy4MUEGNTeK85Ddvys@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3D8Q%2BgNSY2jzgMMtPX-JHUy4MUEGNTeK85Ddvys%40mail.gmail.com

```
I want to rebase the current branch B1 from origin/A1 to origin/A2
so I want to use this command
git --onto origin/A2 origin/A1 B1

Q1: is this command right? (A2 is based on A1, current branch is B1,
B1 is already pushed to origin, a remote repo, and I think I will
force push B1 after rebase)

but I accidentally typed
 git --onto origin/A2 origin/A1 origin/A2
and git says
----
First, rewinding head to replay your work on top of it...
Fast-forwarded origin/base to origin/base.
----

Q2:I assume this command is safe and it didn't change anything right?

THANKS IN ADVANCE

```

## Martin von Zweigbergk, 2011-03-13 01:05

Subject: Re: rebase question
Message-ID: <alpine.DEB.2.00.1103121714280.15442@debian>
URL: https://gitlist.dev/e/alpine.DEB.2.00.1103121714280.15442%40debian
In-Reply-To: <AANLkTi=8Q+gNSY2jzgMMtPX-JHUy4MUEGNTeK85Ddvys@mail.gmail.com>

```
On Fri, 11 Mar 2011, Ryan Sun wrote:

> I want to rebase the current branch B1 from origin/A1 to origin/A2
> so I want to use this command
> git --onto origin/A2 origin/A1 B1
> 
> Q1: is this command right? (A2 is based on A1, current branch is B1,
> B1 is already pushed to origin, a remote repo, and I think I will
> force push B1 after rebase)

Yes, it is correct (except that the "rebase" is missing, of
course). Since A2 is based on A1, you could even use "git rebase
origin/A2 B1".

> but I accidentally typed
>  git --onto origin/A2 origin/A1 origin/A2
> and git says
> ----
> First, rewinding head to replay your work on top of it...
> Fast-forwarded origin/base to origin/base.
> ----

I assume "origin/base" is what you called "origin/A2" above. The
output is a bit confusing in this case.

I tried "git rebase [--onto origin/pu] origin/pu origin/master". That
printed

Fast-forwarded origin/master to origin/pu.

which is even incorrect. It didn't (and shouldn't) update
origin/master, so it obviously shouldn't say that it did
either. Should be easy enough to fix. I will have a look at that when
I get some time.

> Q2:I assume this command is safe and it didn't change anything right?

It detached your HEAD at origin/A2, but no commits, nor refs would
have been changed or lost. You can safely checkout out B1 again if you
want.


/Martin

```
