git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Kristoffer Haugsbakk <code@khaugsbakk.name>
Cc: Stefan Haller <lists@haller-berlin.de>,
	Derrick Stolee <derrickstolee@github.com>,
	 Phillip Wood <phillip.wood123@gmail.com>,
	Christian Couder <christian.couder@gmail.com>,
	 git@vger.kernel.org
Subject: Re: Should --update-refs exclude refs pointing to the current HEAD?
Date: Thu, 7 Mar 2024 00:22:31 -0800	[thread overview]
Message-ID: <CABPp-BG6FZkiiFAT1YC_POqeWrKESmh5a1Sf1vUUQ2QvBYL8xg@mail.gmail.com> (raw)
In-Reply-To: <25aa1b8d-79f6-4b33-be22-735a867367c0@app.fastmail.com>

Hi,

On Wed, Mar 6, 2024 at 11:59 PM Kristoffer Haugsbakk
<code@khaugsbakk.name> wrote:
>
> On Tue, Mar 5, 2024, at 08:40, Stefan Haller wrote:
> > Coming back to this after almost a year, I can say that I'm still
> > running into this problem relatively frequently, and it is annoying
> > every single time. Excluding refs pointing at the current head from
> > being updated, as proposed above, would be a big usability improvement
> > for me.
>
> Sounds like a ref-stash command is in order…

A what?

>     # I want a new branch
>     git checkout -b new
>     # But I don’t want it to be affected by the next rebase

This doesn't make any sense; rebase always operates on the current
branch, and Stefan wasn't asking for anything otherwise.  He was just
concerned that with --update-refs, one of the other branches it also
operated on was one he didn't want it to operate on.

Perhaps you meant
    git branch new
for your first command?

>     git ref-stash push
>     git rebase [...]
>     # Now I’m done: put the ref back where it was
>     git ref-stash pop

Leaving aside questions about how ref-stash is supposed to interact
with each and every other command out there, and how it's supposed to
know which branches it's operating on when you do pushes and pops...

Why do we need to invent a new command, when we already have the
reflog?  You could drop both ref-stash commands, and instead just have
a
   git branch -f new new@{1}
at the end (assuming of course "git branch new" was used instead of
your "git checkout -b new", as I suggested earlier) to put "new" back
to where it was before the rebase.  That's fewer commands.

Or, even simpler, drop the initial branch creation and both ref-stash
commands by just not creating the branch until after the rebase.
That'd make the entire set of commands just be:
   git rebase --update-refs [...]
   git branch new current_branch@{1}

Plus, either solution works today and needs no new changes.

  reply	other threads:[~2024-03-07  8:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  8:21 Should --update-refs exclude refs pointing to the current HEAD? Stefan Haller
2023-04-17  8:30 ` Stefan Haller
2023-04-17  8:34 ` Kristoffer Haugsbakk
2023-04-17  9:22   ` Stefan Haller
2023-04-18  2:00     ` Felipe Contreras
2023-04-17 12:14 ` Phillip Wood
2023-04-20 15:27   ` Stefan Haller
2024-03-05  7:40 ` Stefan Haller
2024-03-05 16:22   ` Junio C Hamano
2024-03-06  2:57     ` Elijah Newren
2024-03-06 21:00       ` Stefan Haller
2024-03-07  5:36         ` Elijah Newren
2024-03-07 20:16           ` Stefan Haller
2024-03-09  3:28             ` Elijah Newren
2024-03-12  9:28               ` Stefan Haller
2024-03-07  7:59   ` Kristoffer Haugsbakk
2024-03-07  8:22     ` Elijah Newren [this message]
2024-03-24 10:42 ` Stefan Haller

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=CABPp-BG6FZkiiFAT1YC_POqeWrKESmh5a1Sf1vUUQ2QvBYL8xg@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=code@khaugsbakk.name \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=lists@haller-berlin.de \
    --cc=phillip.wood123@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).