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

Re: [PATCH 2/2] rebase -i: new option --name-rev

From
Dominique Quatravaux <domq@google.com>
Date
Mar 9, 2012, 09:04 UTC
Message-ID
<CAJh6GrGEix8qfAuJamWzcr69=LjkZ-O9B=Vorvy_KTcJe3TcPA@mail.gmail.com>
In-Reply-To
<4F59AFA9.5030205@viscovery.net>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
>> Today's "git rebase -i" wouldn't do something like that, and we will
>> not know how the user would interact with such a yet-to-be-written
>> tool, so it is too early to judge if using "topic~1" is the desired
>> improvement or not at this point.
>
On Fri, Mar 9, 2012 at 8:22 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Yet-to-be-written? Rebase -i happily linearizes mergy history, so this
> does have some merits even today.

Right, my personal itch is to "transplant" topic branches without their merge history getting in the way, eg go from

   M1 ------ M2 ----- M3 ---- M4                master
     \                  \
      \           B1 --- B2 --- B3              topicB
       \         /
        A1 --- A2 --- A3                        topicA
to
   M1 ---- M2 ---- M3 ---- M4                   master
     \                       \
      \                       B1 ---- B3        topicB
       \
        A1 ---- A2 ---- A3                      topicA
If I "git rebase -i --onto master topicA topicB", the rebase todo might go like
  pick 1234abc Cool shiny new stuff
  pick 234abc1 Something something master
  pick 34abc12 Fix something something
  pick 4abc123 Fix shiny new stuff

With my patch (combined with Junio's suggestion, and some whitespace padding for extra niceness) we would get instead

  pick 1234abc (topicB~2) Cool shiny new stuff
  pick 234abc1 (master~2) Something something master
  pick 34abc12 (master~1) Fix something something
  pick 4abc123 (topicB)   Fix shiny new stuff
Snip the lines that don't m/topicB/ with your text editor, save file, done.
> I do share your concerns that naming to-be-rebased commits with a relative
> specifier such as "topic~1" could be dangerous. However, this is a problem
> only when the rebase -i is not completed timely, so that you have
> sufficient time to mess with the ref "topic" from a different terminal.

I think that Junio's suggestion fixes that (at the expense of 8 of the precious 80 columns).

--
  Dominique Quatravaux
  +41 79 609 40 72
Previous: Johannes SixtNext: Junio C Hamano
Message 10 of 18 in “rebase -i: optimize the creation of the todo file”
  1. 1/2 rebase -i: optimize the creation of the todo fileDominique Quatravaux, Mar 8, 2012
  2. 2/2 rebase -i: new option --name-revDominique Quatravaux, Mar 8, 2012
  3. Thomas RastMar 8, 2012
  4. Dominique QuatravauxMar 8, 2012
  5. Junio C HamanoMar 8, 2012
  6. Dominique QuatravauxMar 9, 2012
  7. Junio C HamanoMar 8, 2012
  8. Junio C HamanoMar 8, 2012
  9. Johannes SixtMar 9, 2012
  10. Dominique QuatravauxMar 9, 2012
  11. Junio C HamanoMar 9, 2012
  12. Thomas RastMar 8, 2012
  13. Dominique QuatravauxMar 8, 2012
  14. Thomas RastMar 8, 2012
  15. Johannes SixtMar 8, 2012
  16. Dominique QuatravauxMar 8, 2012
  17. Dominique QuatravauxMar 8, 2012
  18. Johannes SixtMar 8, 2012

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.