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

Re: [PATCH 3/3] rebase: use peel_committish() where appropriate

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 17, 2013, 02:52 UTC
Message-ID
<7vy5a9ih32.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CALkWK0k5jgafQa6b5=_d2vTT1zzdc4rCgzuoFhOCA1Xtm8v19w@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 12 quoted lines
> Junio C Hamano wrote:
>> You can also specify the commit at the end of the history to be
>> rebased (very useful while trial runs to see where a series should
>> apply):
>>
>>     git rebase foo ":/Add B"
>>
>> This is already handled properly because it first gets turned into
>> an object name $orig_head and then we use it (without ^0) to update
>> the ORIG_HEAD.
>
> Correct, but what sense does it make unless <branch> is a ref to update?

It often is necessary, after applying a patch series that was prepared against commit that is unnecessarily new (e.g. a bugfix that should apply to 'maint' prepared against 'next'), to see if the result rebases on older codebase. Giving a commit (not branch) to the command to force rebasing the commit on a detached HEAD is a very handy technique to do so without damaging the original branch.

    $ git checkout mater^0
    $ git am -s mbox
    Applying A
    Applying B
    Applying C
    $ git rebase --onto maint master ":/B"

would see if the earlier two commits that are pure bugfix cleanly applies to 'maint' (and then I can rebuild the topic by forking a branch from 'maint', queue A and B, and if C is not needed for that fix, fork another from that point, possibly merge 'master' to it and then queue C).

Show 7 quoted lines
>> What would happen when you are given "--onto :/f...o" is somewhat
>> interesting, but that may be a separate topic, I think.  At that
>> point, it is probably in the realm of "don't do it then" ;-)
>
> The utility of this very series can be questioned.  I've rarely wanted
> to use the :/fommery with rebase, so this mostly an exercise in
> "theoretical correctness" (something I usually stay away from).
We are saying the same thing: "don't do it then".
Previous: Ramkumar Ramachandra
Message 10 of 10 in “Get rebase to work with :/foomery committish”
  1. 0/3 Get rebase to work with :/foomery committishRamkumar Ramachandra, Jun 14, 2013
  2. 1/3 t/rebase: add failing tests for a peculiar revisionRamkumar Ramachandra, Jun 14, 2013
  3. 2/3 sh-setup: add new peel_committish() helperRamkumar Ramachandra, Jun 14, 2013
  4. Philip OakleyJun 14, 2013
  5. Ramkumar RamachandraJun 14, 2013
  6. Philip OakleyJun 14, 2013
  7. 3/3 rebase: use peel_committish() where appropriateRamkumar Ramachandra, Jun 14, 2013
  8. Junio C HamanoJun 14, 2013
  9. Ramkumar RamachandraJun 15, 2013
  10. Junio C HamanoJun 17, 2013

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.