* Interactive rebase: using "pick" for merge commits
@ 2024-02-09 15:52 Stefan Haller
2024-02-09 16:24 ` Phillip Wood
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Haller @ 2024-02-09 15:52 UTC (permalink / raw)
To: git
When I do an interactive rebase, and manually enter a "pick" with the
commit hash of a merge commit, I get the following confusing error message:
error: commit fa1afe1 is a merge but no -m option was given.
hint: Could not execute the todo command
hint:
hint: pick fa1afe1 some subject
hint:
hint: It has been rescheduled; [rest of message snipped]
This error message makes it sound like I could somehow add "-m1" after
the "pick" to make it work (which is actually what I would like to be
able to do). I had to go read the source code to find out that that's
not the case, and the error message only comes from the fact that the
code is shared with the cherry-pick and revert commands, which do have
the -m option.
Is it crazy to want pick to work like this? Should it be supported?
-Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-09 15:52 Interactive rebase: using "pick" for merge commits Stefan Haller
@ 2024-02-09 16:24 ` Phillip Wood
2024-02-10 9:23 ` Stefan Haller
0 siblings, 1 reply; 10+ messages in thread
From: Phillip Wood @ 2024-02-09 16:24 UTC (permalink / raw)
To: Stefan Haller, git
Hi Stefan
On 09/02/2024 15:52, Stefan Haller wrote:
> When I do an interactive rebase, and manually enter a "pick" with the
> commit hash of a merge commit, I get the following confusing error message:
>
> error: commit fa1afe1 is a merge but no -m option was given.
> hint: Could not execute the todo command
> hint:
> hint: pick fa1afe1 some subject
> hint:
> hint: It has been rescheduled; [rest of message snipped]
>
> This error message makes it sound like I could somehow add "-m1" after
> the "pick" to make it work (which is actually what I would like to be
> able to do). I had to go read the source code to find out that that's
> not the case, and the error message only comes from the fact that the
> code is shared with the cherry-pick and revert commands, which do have
> the -m option.
Oh, that's unfortunate - we should really reject the todo list when we
parse it at the start of the rebase if it is going to try and "pick" a
merge.
> Is it crazy to want pick to work like this? Should it be supported?
It causes problems trying to maintain the topology. In the past there
was a "--preserve-merges" option that allowed one to "pick" merges but
it broke if the user edited the todo list. The "--rebase-merges" option
was introduced with the "label", "reset" and "merge" todo list
instructions to allow the user to control the topology.
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-09 16:24 ` Phillip Wood
@ 2024-02-10 9:23 ` Stefan Haller
2024-02-12 7:15 ` Patrick Steinhardt
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Haller @ 2024-02-10 9:23 UTC (permalink / raw)
To: phillip.wood, git
On 09.02.24 17:24, Phillip Wood wrote:
> On 09/02/2024 15:52, Stefan Haller wrote:
>> When I do an interactive rebase, and manually enter a "pick" with the
>> commit hash of a merge commit, I get the following confusing error
>> message:
>>
>> error: commit fa1afe1 is a merge but no -m option was given.
>>
>> Is it crazy to want pick to work like this? Should it be supported?
>
> It causes problems trying to maintain the topology. In the past there
> was a "--preserve-merges" option that allowed one to "pick" merges but
> it broke if the user edited the todo list. The "--rebase-merges" option
> was introduced with the "label", "reset" and "merge" todo list
> instructions to allow the user to control the topology.
Yes, I'm familiar with all this, but that's not what I mean. I don't
want to maintain the topology here, and I'm also not suggesting that git
itself generates such "pick" entries with -mX arguments (maybe I wasn't
clear on that). What I want to do is to add such entries myself, as a
user, resulting in the equivalent of doing a "break" at that point in
the rebase and doing a "git cherry-pick -mX <hash-of-merge-commit>"
manually.
-Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-10 9:23 ` Stefan Haller
@ 2024-02-12 7:15 ` Patrick Steinhardt
2024-02-12 14:38 ` Phillip Wood
2024-02-12 16:39 ` Junio C Hamano
0 siblings, 2 replies; 10+ messages in thread
From: Patrick Steinhardt @ 2024-02-12 7:15 UTC (permalink / raw)
To: Stefan Haller; +Cc: phillip.wood, git
[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]
On Sat, Feb 10, 2024 at 10:23:16AM +0100, Stefan Haller wrote:
> On 09.02.24 17:24, Phillip Wood wrote:
> > On 09/02/2024 15:52, Stefan Haller wrote:
> >> When I do an interactive rebase, and manually enter a "pick" with the
> >> commit hash of a merge commit, I get the following confusing error
> >> message:
> >>
> >> error: commit fa1afe1 is a merge but no -m option was given.
> >>
> >> Is it crazy to want pick to work like this? Should it be supported?
> >
> > It causes problems trying to maintain the topology. In the past there
> > was a "--preserve-merges" option that allowed one to "pick" merges but
> > it broke if the user edited the todo list. The "--rebase-merges" option
> > was introduced with the "label", "reset" and "merge" todo list
> > instructions to allow the user to control the topology.
>
> Yes, I'm familiar with all this, but that's not what I mean. I don't
> want to maintain the topology here, and I'm also not suggesting that git
> itself generates such "pick" entries with -mX arguments (maybe I wasn't
> clear on that). What I want to do is to add such entries myself, as a
> user, resulting in the equivalent of doing a "break" at that point in
> the rebase and doing a "git cherry-pick -mX <hash-of-merge-commit>"
> manually.
It would be neat indeed if this could be specified in the instruction
sheet. We already support options for the "merge" instruction, so
extending "pick" to support options isn't that far-fetched. Then it
would become possible to say "pick -m1 fa1afe1".
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-12 7:15 ` Patrick Steinhardt
@ 2024-02-12 14:38 ` Phillip Wood
2024-02-23 20:59 ` Stefan Haller
2024-02-12 16:39 ` Junio C Hamano
1 sibling, 1 reply; 10+ messages in thread
From: Phillip Wood @ 2024-02-12 14:38 UTC (permalink / raw)
To: Patrick Steinhardt, Stefan Haller; +Cc: phillip.wood, git
Hi Patrick and Stefan
On 12/02/2024 07:15, Patrick Steinhardt wrote:
> On Sat, Feb 10, 2024 at 10:23:16AM +0100, Stefan Haller wrote:
>> On 09.02.24 17:24, Phillip Wood wrote:
>> Yes, I'm familiar with all this, but that's not what I mean. I don't
>> want to maintain the topology here, and I'm also not suggesting that git
>> itself generates such "pick" entries with -mX arguments (maybe I wasn't
>> clear on that). What I want to do is to add such entries myself, as a
>> user, resulting in the equivalent of doing a "break" at that point in
>> the rebase and doing a "git cherry-pick -mX <hash-of-merge-commit>"
>> manually.
>
> It would be neat indeed if this could be specified in the instruction
> sheet. We already support options for the "merge" instruction, so
> extending "pick" to support options isn't that far-fetched. Then it
> would become possible to say "pick -m1 fa1afe1".
It would certainly be possible to extend the sequencer to do that but
I'm not familiar with why people use "git cherry-pick -m" [1] so I'm
wondering what this would be used for. It would involve a bit of extra
complexity so I think we'd want a compelling reason as to why
cherry-picking merges without maintaining the topology is useful
especially as one can currently do that via "exec git cherry-pick -m ..."
Best Wishes
Phillip
[1] I did a quick web search and the results all seemed to focus on how
to do it rather than why you'd want to.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-12 7:15 ` Patrick Steinhardt
2024-02-12 14:38 ` Phillip Wood
@ 2024-02-12 16:39 ` Junio C Hamano
1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2024-02-12 16:39 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: Stefan Haller, phillip.wood, git
Patrick Steinhardt <ps@pks.im> writes:
> On Sat, Feb 10, 2024 at 10:23:16AM +0100, Stefan Haller wrote:
>> On 09.02.24 17:24, Phillip Wood wrote:
>> > On 09/02/2024 15:52, Stefan Haller wrote:
>> >> When I do an interactive rebase, and manually enter a "pick" with the
>> >> commit hash of a merge commit, I get the following confusing error
>> >> message:
>> >>
>> >> error: commit fa1afe1 is a merge but no -m option was given.
>> >>
>> >> Is it crazy to want pick to work like this? Should it be supported?
>> >
>> > It causes problems trying to maintain the topology. In the past there
>> > was a "--preserve-merges" option that allowed one to "pick" merges but
>> > it broke if the user edited the todo list. The "--rebase-merges" option
>> > was introduced with the "label", "reset" and "merge" todo list
>> > instructions to allow the user to control the topology.
>>
>> Yes, I'm familiar with all this, but that's not what I mean. I don't
>> want to maintain the topology here, and I'm also not suggesting that git
>> itself generates such "pick" entries with -mX arguments (maybe I wasn't
>> clear on that). What I want to do is to add such entries myself, as a
>> user, resulting in the equivalent of doing a "break" at that point in
>> the rebase and doing a "git cherry-pick -mX <hash-of-merge-commit>"
>> manually.
>
> It would be neat indeed if this could be specified in the instruction
> sheet. We already support options for the "merge" instruction, so
> extending "pick" to support options isn't that far-fetched. Then it
> would become possible to say "pick -m1 fa1afe1".
Would adding "x git cherry-pick -m 1 $that_one" work there?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-12 14:38 ` Phillip Wood
@ 2024-02-23 20:59 ` Stefan Haller
2024-02-26 10:56 ` Phillip Wood
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Haller @ 2024-02-23 20:59 UTC (permalink / raw)
To: phillip.wood, Patrick Steinhardt; +Cc: git
On 12.02.24 15:38, Phillip Wood wrote:
> Hi Patrick and Stefan
>
> On 12/02/2024 07:15, Patrick Steinhardt wrote:
>> On Sat, Feb 10, 2024 at 10:23:16AM +0100, Stefan Haller wrote:
>>> On 09.02.24 17:24, Phillip Wood wrote:
>>> Yes, I'm familiar with all this, but that's not what I mean. I don't
>>> want to maintain the topology here, and I'm also not suggesting that git
>>> itself generates such "pick" entries with -mX arguments (maybe I wasn't
>>> clear on that). What I want to do is to add such entries myself, as a
>>> user, resulting in the equivalent of doing a "break" at that point in
>>> the rebase and doing a "git cherry-pick -mX <hash-of-merge-commit>"
>>> manually.
>>
>> It would be neat indeed if this could be specified in the instruction
>> sheet. We already support options for the "merge" instruction, so
>> extending "pick" to support options isn't that far-fetched. Then it
>> would become possible to say "pick -m1 fa1afe1".
>
> It would certainly be possible to extend the sequencer to do that but
> I'm not familiar with why people use "git cherry-pick -m" [1] so I'm
> wondering what this would be used for. It would involve a bit of extra
> complexity so I think we'd want a compelling reason as to why
> cherry-picking merges without maintaining the topology is useful
> especially as one can currently do that via "exec git cherry-pick -m ..."
Ok, I suppose the answer will probably not count as a compelling reason.
My reason for wanting this is that lazygit currently implements
cherry-picking in terms of an interactive rebase, rather then calling
git-cherry-pick. And the reason why it does this is that when you
cherry-pick multiple commits, and one of them conflicts, then you get
lazygit's nice visualization of the rebase todo list to show you where
in the sequence you are, what the conflicting commit is, how many are
left etc. It just happens to support this well for
.git/rebase-merge/git-rebase-todo, but not for .git/sequencer/todo.
It probably makes more sense to teach lazygit to visualize the
.git/sequencer/todo file, and then use git cherry-pick.
See https://github.com/jesseduffield/lazygit/issues/3317
-Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-23 20:59 ` Stefan Haller
@ 2024-02-26 10:56 ` Phillip Wood
2024-02-26 19:07 ` Stefan Haller
0 siblings, 1 reply; 10+ messages in thread
From: Phillip Wood @ 2024-02-26 10:56 UTC (permalink / raw)
To: Stefan Haller, phillip.wood, Patrick Steinhardt; +Cc: git
Hi Stefan
On 23/02/2024 20:59, Stefan Haller wrote:
> On 12.02.24 15:38, Phillip Wood wrote:
>> Hi Patrick and Stefan
>>
>> It would certainly be possible to extend the sequencer to do that but
>> I'm not familiar with why people use "git cherry-pick -m" [1] so I'm
>> wondering what this would be used for. It would involve a bit of extra
>> complexity so I think we'd want a compelling reason as to why
>> cherry-picking merges without maintaining the topology is useful
>> especially as one can currently do that via "exec git cherry-pick -m ..."
>
> Ok, I suppose the answer will probably not count as a compelling reason.
> My reason for wanting this is that lazygit currently implements
> cherry-picking in terms of an interactive rebase, rather then calling
> git-cherry-pick. And the reason why it does this is that when you
> cherry-pick multiple commits, and one of them conflicts, then you get
> lazygit's nice visualization of the rebase todo list to show you where
> in the sequence you are, what the conflicting commit is, how many are
> left etc. It just happens to support this well for
> .git/rebase-merge/git-rebase-todo, but not for .git/sequencer/todo.
Thanks for the context. I can see how that is convenient for lazygit
(and makes we think that perhaps we should teach "git status" to show
pending cherry-picks) but I'm afraid I don't think that is a good reason
for adding the ability to pick merges to git rebase.
> It probably makes more sense to teach lazygit to visualize the
> .git/sequencer/todo file, and then use git cherry-pick.
If lazygit is generating the todo list for the cherry-pick could it
check if the commit is a merge and insert "exec cherry-pick -m ..." for
those commits? The UI could detect that and display something more user
friendly for those lines in the todo list. It is still more work for
lazygit but perhaps less than supporting cherry-picks directly.
Best Wishes
Phillip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-26 10:56 ` Phillip Wood
@ 2024-02-26 19:07 ` Stefan Haller
2024-02-27 10:41 ` phillip.wood123
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Haller @ 2024-02-26 19:07 UTC (permalink / raw)
To: phillip.wood, Patrick Steinhardt; +Cc: git
On 26.02.24 11:56, Phillip Wood wrote:
>> It probably makes more sense to teach lazygit to visualize the
>> .git/sequencer/todo file, and then use git cherry-pick.
>
> If lazygit is generating the todo list for the cherry-pick could it
> check if the commit is a merge and insert "exec cherry-pick -m ..." for
> those commits?
That's a good idea, but it wouldn't buy us very much. We'd still have to
add support for conflicts during a cherry-pick; when there's a conflict
during a rebase, lazygit has this nice visualization of the conflicting
commit (we talked about that in [1], and it turned out to be working
extremely well), so it would have to learn to do the same thing for a
conflicting cherry-pick (although this does seem to be a lot easier).
And then it would have to learn to call "cherry-pick --continue" rather
than "rebase --continue" after resolving. But if we do all these things,
then we're not so far away from being able to just call git cherry-pick
ourselves.
-Stefan
[1] <https://public-inbox.org/git/
961e68d7-5f43-c385-10fa-455b8e2f32d0@haller-berlin.de/>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Interactive rebase: using "pick" for merge commits
2024-02-26 19:07 ` Stefan Haller
@ 2024-02-27 10:41 ` phillip.wood123
0 siblings, 0 replies; 10+ messages in thread
From: phillip.wood123 @ 2024-02-27 10:41 UTC (permalink / raw)
To: Stefan Haller, phillip.wood, Patrick Steinhardt; +Cc: git
On 26/02/2024 19:07, Stefan Haller wrote:
> On 26.02.24 11:56, Phillip Wood wrote:
>>> It probably makes more sense to teach lazygit to visualize the
>>> .git/sequencer/todo file, and then use git cherry-pick.
>>
>> If lazygit is generating the todo list for the cherry-pick could it
>> check if the commit is a merge and insert "exec cherry-pick -m ..." for
>> those commits?
>
> That's a good idea, but it wouldn't buy us very much. We'd still have to
> add support for conflicts during a cherry-pick; when there's a conflict
> during a rebase, lazygit has this nice visualization of the conflicting
> commit (we talked about that in [1], and it turned out to be working
> extremely well), so it would have to learn to do the same thing for a
> conflicting cherry-pick (although this does seem to be a lot easier).
> And then it would have to learn to call "cherry-pick --continue" rather
> than "rebase --continue" after resolving. But if we do all these things,
> then we're not so far away from being able to just call git cherry-pick
> ourselves.
Oh I'd forgotten about handling conflicts - that does make my proposal
less attractive.
Best Wishes
Phillip
> -Stefan
>
> [1] <https://public-inbox.org/git/
> 961e68d7-5f43-c385-10fa-455b8e2f32d0@haller-berlin.de/>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-02-27 10:42 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 15:52 Interactive rebase: using "pick" for merge commits Stefan Haller
2024-02-09 16:24 ` Phillip Wood
2024-02-10 9:23 ` Stefan Haller
2024-02-12 7:15 ` Patrick Steinhardt
2024-02-12 14:38 ` Phillip Wood
2024-02-23 20:59 ` Stefan Haller
2024-02-26 10:56 ` Phillip Wood
2024-02-26 19:07 ` Stefan Haller
2024-02-27 10:41 ` phillip.wood123
2024-02-12 16:39 ` Junio C Hamano
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).