# Can not rebase to first commit

7 messages from 2021-01-25 to 2021-01-26. Participants: Eugen Konkov, Matheus Tavares Bernardino, Taylor Blau, Thomas Braun, Martin Ågren, Kevin Daudt.
Thread: https://gitlist.dev/t/55043

## Eugen Konkov, 2021-01-25 10:38

Subject: Can not rebase to first commit
Message-ID: <1327609829.20210125123816@yandex.ru>
URL: https://gitlist.dev/e/1327609829.20210125123816%40yandex.ru

```
I can not rebase to first commit.

This is how to reproduce:

kes@work ~/work/projects/general/Auth $ git tree
* 67857d5 (HEAD -> dev) asdf
* 1e99034 (local/dev) Initial commit
kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
fatal: invalid upstream '1e99034^'


git --version
git version 2.30.0

--
Best regards,
Eugen Konkov 


```

## Matheus Tavares Bernardino, 2021-01-25 16:53

Subject: Re: Can not rebase to first commit
Message-ID: <CAHd-oW6=CFNGyW30pDhjwgwMcDFeqFoad=J6DkHruaeA75SzCw@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd-oW6%3DCFNGyW30pDhjwgwMcDFeqFoad%3DJ6DkHruaeA75SzCw%40mail.gmail.com
In-Reply-To: <1327609829.20210125123816@yandex.ru>

```
Hi, Eugen

On Mon, Jan 25, 2021 at 7:50 AM Eugen Konkov <kes-kes@yandex.ru> wrote:
>
> I can not rebase to first commit.
>
> This is how to reproduce:
>
> kes@work ~/work/projects/general/Auth $ git tree
> * 67857d5 (HEAD -> dev) asdf
> * 1e99034 (local/dev) Initial commit
> kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
> fatal: invalid upstream '1e99034^'

'1e99034^' means "the first parent of 1e99034". However, this is the
root commit of your branch, so it has no parent. That's why rebase
complained about  '1e99034^' being invalid. To rebase this commit you
can instead use the --root option.

Thanks,
Matheus

```

## Taylor Blau, 2021-01-25 14:21

Subject: Re: Can not rebase to first commit
Message-ID: <YA7T8fo5zngSD+zd@nand.local>
URL: https://gitlist.dev/e/YA7T8fo5zngSD%2Bzd%40nand.local
In-Reply-To: <1327609829.20210125123816@yandex.ru>

```
On Mon, Jan 25, 2021 at 12:38:16PM +0200, Eugen Konkov wrote:
> I can not rebase to first commit.
>
> This is how to reproduce:
>
> kes@work ~/work/projects/general/Auth $ git tree
> * 67857d5 (HEAD -> dev) asdf
> * 1e99034 (local/dev) Initial commit

(Unrelated to your question, but I assume that 'git tree' is an alias of
'git log --oneline --graph' by the looks of it).

> kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
> fatal: invalid upstream '1e99034^'

Yes, this is because you're asking to rebase your branch onto the parent
of 1e99034, which doesn't exist because 1e99034 is the "root" commit and
therefore has no parents.

'git rebase' has a special option for exactly this case, which is
'--root'. By replacing '1e99034^' with '--root', you should be able to
do what you want.

Thanks,
Taylor

```

## Thomas Braun, 2021-01-25 13:24

Subject: Re: Can not rebase to first commit
Message-ID: <13e03215-76ad-ad8a-0da3-e18088f69416@virtuell-zuhause.de>
URL: https://gitlist.dev/e/13e03215-76ad-ad8a-0da3-e18088f69416%40virtuell-zuhause.de
In-Reply-To: <1327609829.20210125123816@yandex.ru>

```
On 1/25/2021 11:38 AM, Eugen Konkov wrote:
> I can not rebase to first commit.
> 
> This is how to reproduce:
> 
> kes@work ~/work/projects/general/Auth $ git tree
> * 67857d5 (HEAD -> dev) asdf
> * 1e99034 (local/dev) Initial commit
> kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
> fatal: invalid upstream '1e99034^'

See `git rebase --root` where the documentation says "This allows you to
rebase the root commit(s) on a branch.".


```

## Martin Ågren, 2021-01-25 11:30

Subject: Re: Can not rebase to first commit
Message-ID: <CAN0heSp-bd-Dy4rT7DmEx3TQELoCr7a81WQLsT7wWdmbm5ZQ1g@mail.gmail.com>
URL: https://gitlist.dev/e/CAN0heSp-bd-Dy4rT7DmEx3TQELoCr7a81WQLsT7wWdmbm5ZQ1g%40mail.gmail.com
In-Reply-To: <1327609829.20210125123816@yandex.ru>

```
On Mon, 25 Jan 2021 at 11:53, Eugen Konkov <kes-kes@yandex.ru> wrote:
>
> I can not rebase to first commit.
>
> This is how to reproduce:
>
> kes@work ~/work/projects/general/Auth $ git tree
> * 67857d5 (HEAD -> dev) asdf
> * 1e99034 (local/dev) Initial commit
> kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
> fatal: invalid upstream '1e99034^'

The commit 1e99034 has no parent, so 1e99034^ errors out.

Try the `--root` option. That should do what you want.

Martin

```

## Kevin Daudt, 2021-01-25 11:22

Subject: Re: Can not rebase to first commit
Message-ID: <YA6qDe07eHNKBE6l@alpha>
URL: https://gitlist.dev/e/YA6qDe07eHNKBE6l%40alpha
In-Reply-To: <1327609829.20210125123816@yandex.ru>

```
On Mon, Jan 25, 2021 at 12:38:16PM +0200, Eugen Konkov wrote:
> I can not rebase to first commit.
> 
> This is how to reproduce:
> 
> kes@work ~/work/projects/general/Auth $ git tree
> * 67857d5 (HEAD -> dev) asdf
> * 1e99034 (local/dev) Initial commit
> kes@work ~/work/projects/general/Auth $ git rebase -i --autostash --rebase-merges 1e99034^
> fatal: invalid upstream '1e99034^'
> 
> 
> git --version
> git version 2.30.0
> 
> --
> Best regards,
> Eugen Konkov 
> 

This is because the first commit (1e99034) does not have a parent, so
1e99034^ cannot be resolved.

git rebase does however have an option for this: git rebase -i --root.
That allows you to rebase the root commit.

Hope this helps, Kevin

```

## Eugen Konkov, 2021-01-26 17:26

Subject: Re: Can not rebase to first commit
Message-ID: <789931525.20210126192600@yandex.ru>
URL: https://gitlist.dev/e/789931525.20210126192600%40yandex.ru
In-Reply-To: <CAHd-oW6=CFNGyW30pDhjwgwMcDFeqFoad=J6DkHruaeA75SzCw@mail.gmail.com>

```
Thank you for all.

I always thought that 1e99034^ means: including this commit

Thanks for help


```
