Git development
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Erik Cervin Edin <erik@cervined.in>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Git rebase no longer defaults to upstream after force push
Date: Tue, 18 Apr 2023 15:01:41 +0100	[thread overview]
Message-ID: <788c85f0-1381-4d37-cb23-dd67f26a5b6a@gmail.com> (raw)
In-Reply-To: <CA+JQ7M_KuDXBaVTzVwLTx+R4-6-3TOuUOpcchkS26iiosc85Hg@mail.gmail.com>

Hi Erik

Thanks for reporting this, unfortunately without knowing more about your 
config settings it is hard to tell what is happening here.

On 18/04/2023 10:17, Erik Cervin Edin wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
 >
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
>    git init --bare foo.git && git clone foo.git/ foo && cd foo
>    touch bar && git add bar && git commit -m init
>    git push -u

This sets the upstream branch for main to origin/main, (assuming 
push.default allows pushing without specifying a refspec)

>    git switch -c a

Here you create a new branch, whether switch sets an upstream for it 
depends on the value of branch.autoSetupMerge. The default is not to set 
an upstream branch in this case. If you have set branch.autoSetupMerge 
to "always" then the upstream branch will be "main", if 
branch.autoSetupMerge is set to "inherit" then the upstream branch will 
be "origin/main". What does branch -vv show?

>    seq 1 3 > bar && git add bar && git commit -m 1
>    git push

What happens here depends on push.default, branch.autoSetupMerge and 
push.autoSetupRemote. If switch did not set an upstream branch then push 
will if you have push.autoSetupRemote enabled.

>    seq 11 13 > bar && git add bar && git commit -m 2
>    git rebase -ir # Works like git rebase -ir @{upstream}
>    git push --force origin main:a
>    git rebase -ir # No longer works like git rebase -ir @{upstream}

Without knowing what the upstream branch is it is hard to say what is 
going on here.

Best Wishes

Phillip

> What did you expect to happen? (Expected behavior)
> 
> After force pushing, I still expected the rebase to work like git
> rebase -ir @{upstream}.
> 
> What happened instead? (Actual behavior)
> 
> The rebase defaults to a commit other than that of the tip of the
> upstream branch.
> 
> What's different between what you expected and what actually happened?
> 
> Instead of behaving like git rebase @{upstream}, the rebase seems to
> default to rebasing on-top of the old upstream.
> 
> git rebase -ir result in a todo like this:
> 
> l onto
> 
> t onto
> p f1cfbff 2023-04-18    2
> 
> Compared to git rebase -ir @{upstream} which results in a todo like this:
> 
> l onto
> 
> t onto
> p 01e3c92 2023-04-18    1
> p f1cfbff 2023-04-18    2
> 
> Anything else you want to add:
> 
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
> 
> 
> [System Info]
> git version:
> git version 2.40.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27
> 02:56:13 UTC 2023 x86_64
> compiler info: gnuc: 11.3
> libc info: glibc: 2.35
> $SHELL (typically, interactive shell): /bin/bash
> 
> 
> [Enabled Hooks]
> 

  reply	other threads:[~2023-04-18 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  9:17 Git rebase no longer defaults to upstream after force push Erik Cervin Edin
2023-04-18 14:01 ` Phillip Wood [this message]
2023-04-18 15:54 ` Cem Gündoğdu
2023-04-19 15:43   ` Erik Cervin Edin
2023-04-19 17:03     ` Sergey Organov
2023-04-19  0:06 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=788c85f0-1381-4d37-cb23-dd67f26a5b6a@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=erik@cervined.in \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox