git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] commit: do not switch branch during a rebase unless -f is given

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 28, 2010, 05:38 UTC
Message-ID
<7vfwwuv35o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1285649564-24737-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 8 quoted lines
> It does not make much sense to switch branch when you are in a middle
> of a rebase. Sometimes you might want to switch away for a moment then
> back with "git checkout - ". But I find myself so many times switching
> away then forget that I was rebasing something.
>
> Avoid doing that by default. Users can use -f if they really want to.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
I think you need to retitle the patch.

You should realize that overloading "-f" and conflating its totally different meaning, which is to discard local changes, with this new usage to say "override the 'you are in rebase' switch" closes the door to future improvements we could make to rebase so that it does not to require a totally clean working tree. It would be Ok with today's rebase, as you wouldn't have local changes when it runs, but we might regret this 9 months down the road.

>  I know there are other commands like rebase ("git am" comes to mind)
>  but I don't use those. Feel free to put some more on top if somebody
>  finds it a good thing to do.

If you envision something similar to be used during "git am", then you really shouldn't be reusing "-f", as "git am" is designed to be usable in a dirty working tree.

Previous: Jonathan NiederNext: Sverre Rabbelier
Message 11 of 12 in “commit: do not switch branch during a rebase unless -f is given”
  1. commit: do not switch branch during a rebase unless -f is givenNguyễn Thái Ngọc Duy, Sep 28, 2010
  2. checkout: do not switch branch during a rebase unless -f is givenNguyễn Thái Ngọc Duy, Sep 28, 2010
  3. Jonathan NiederSep 28, 2010
  4. Nguyen Thai Ngoc DuySep 28, 2010
  5. Nguyen Thai Ngoc DuyNov 9, 2010
  6. Jonathan NiederNov 9, 2010
  7. Sverre RabbelierNov 9, 2010
  8. Jonathan NiederNov 9, 2010
  9. Nguyen Thai Ngoc DuyNov 9, 2010
  10. Jonathan NiederNov 9, 2010
  11. Junio C HamanoSep 28, 2010
  12. Sverre RabbelierSep 28, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.