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

Re: How to rebase when some commit hashes are in some commit messages

From
Philip Oakley <philipoakley@iee.org>
Date
Oct 16, 2015, 08:01 UTC
Message-ID
<84D417D967EA4E31B0AD471329E9577C@PhilipOakley>
In-Reply-To
<alpine.DEB.1.00.1510151134250.31610@s15462909.onlinehome-server.info>
From: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Show 18 quoted lines
> Hi Francois-Xavier,
>
> On Thu, 15 Oct 2015, Francois-Xavier Le Bail wrote:
>
>> On 13/10/2015 15:29, Philip Oakley wrote:
>>
>> > Thus the only sha1 numbers that could be used are those that are
>> > within the (possibly implied) instruction sheet (which will list the
>> > current sha1s that will be converted by rebase to new sha1's).
>>
>> Yes.
>
> So what happens for commits that are in the pick list but then end up not
> being rewritten at all, e.g. when a patch has been applied upstream (and
> the --cherry logic did not detect that) and then you end up with a "No
> changes to commit"? And what if a patch ends up in merge conflicts and the
> user just skips it? And what if the referenced commit is to be picked
> *afterwards* due to the commits being reordered?

My policy (bikeshed) for these style of occurrences would be that such 'disappeared sha1 refs' should be considered as equivalent to a 'merge conflict' "known"<>"unknown", and drop the user into the appropriate review code path so the user can fix it up.

A sha1 ref can only 'disappear' if it was known before hand, that is, it must have been reachable from the tip of the original rebase.

Only those commits between the original rebase tip and its merge-base with the destination (e.g. --onto) are candidates for re-write. When taken along with the minimum (config) length for a sha1 it should be pretty robust to false positives.

In the case of --orphan branch rebasing one does get left and right roots for the 'merge-base' which is a particular corner case.

Show 13 quoted lines
>
> It would appear that the strategy you propose is still too ill-defined to
> make for a robust feature.
>
> Ciao,
> Johannes
>
> P.S.: The recommended way to refer to a commit is not only using the SHA-1
> but also mentioning the one-line, and even the date. That way, even
> rebased commits can found most of the time. This is not fool-proof, by
> far, of course, but still better than trying to rewrite a SHA-1 and
> failing.
>

In terms of re-writing a quoted --one-line ref, the tool must also be told (config option) the few valid quoting commands the user wishes to re-write, so that if the sha1 is part of a full quote then the whole quote can be replaced by a fresh quote of the updated commit (especially in the --onto case).

Previous: Johannes SchindelinNext: Thomas Koch
Message 15 of 17 in “How to rebase when some commit hashes are in some commit messages”
  1. Francois-Xavier Le BailOct 12, 2015
  2. Matthieu MoyOct 12, 2015
  3. Francois-Xavier Le BailOct 13, 2015
  4. Konstantin KhomoutovOct 13, 2015
  5. Philip OakleyOct 13, 2015
  6. Jacob KellerOct 13, 2015
  7. Mike RappazzoOct 13, 2015
  8. Philip OakleyOct 13, 2015
  9. Jacob KellerOct 13, 2015
  10. Philip OakleyOct 13, 2015
  11. Francois-Xavier Le BailOct 15, 2015
  12. Francois-Xavier Le BailOct 15, 2015
  13. Francois-Xavier Le BailOct 15, 2015
  14. Johannes SchindelinOct 15, 2015
  15. Philip OakleyOct 16, 2015
  16. Thomas KochOct 18, 2015
  17. Ævar Arnfjörð BjarmasonOct 18, 2015

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.