{"thread":{"id":"63838","subject":"Show skipped commit message after rebase conflict?","startedAt":"2025-07-24T14:43:33Z","lastAt":"2025-07-26T15:00:17Z","messageCount":11,"participants":["Cameron Steffen","Junio C Hamano","Phillip Wood","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"522680","messageId":"CAAVFnNkdgXuUk6ziu5FkB=sAHzEOyiynQpQJFox_p_ZL9VGRfg@mail.gmail.com","threadId":"63838","inReplyTo":null,"subject":"Show skipped commit message after rebase conflict?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2025-07-24T14:43:20Z","receivedAt":"2025-07-24T14:43:33Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"Hello Git Community!\n\nSometimes I run into a conflict in a rebase and I end up resolving the\nconflict by removing all the changes. Then when I run `git rebase\n--continue`, the current commit is skipped and the rebase continues\nnormally. Would it be possible to emit a message showing that the\ncommit was skipped in this case? It isn't very obvious to me in my\nworkflow that that is what occurred.\n\nThanks,\nCameron Steffen\n"},{"id":"522705","messageId":"xmqqwm7xxn4a.fsf@gitster.g","threadId":"63838","inReplyTo":"CAAVFnNkdgXuUk6ziu5FkB=sAHzEOyiynQpQJFox_p_ZL9VGRfg@mail.gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-24T22:03:33Z","receivedAt":"2025-07-24T22:03:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Cameron Steffen <cam.steffen94@gmail.com> writes:\n\n> Sometimes I run into a conflict in a rebase and I end up resolving the\n> conflict by removing all the changes. Then when I run `git rebase\n> --continue`, the current commit is skipped and the rebase continues\n> normally. Would it be possible to emit a message showing that the\n> commit was skipped in this case? It isn't very obvious to me in my\n> workflow that that is what occurred.\n\nI do not know what level of verbosity is needed to grab attention by\nthe end user, but something like this might be a good starting\npoint?\n\nTotally untested, and there may be implications (like, control\npasses this point in different situations where the messages is not\nwarranted).\n\nI'll pick a few people from \n\n    git shortlog --since=2.years --no-merges sequencer.c\n\nbased on their contribution to the file (not counting the internal\nimplementation changes) and Cc them to see if they have ideas.\n\nThanks.\n\n sequencer.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git c/sequencer.c w/sequencer.c\nindex 67e4310edc..677d6105dd 100644\n--- c/sequencer.c\n+++ w/sequencer.c\n@@ -5369,6 +5369,8 @@ static int commit_staged_changes(struct repository *r,\n \t\t\tgoto out;\n \t\t}\n \n+\t\twarning(_(\"omitting a step that has become empty\"));\n+\n \t\tif (!final_fixup) {\n \t\t\tret = 0;\n \t\t\tgoto out;\n\n"},{"id":"522745","messageId":"184ec60f-9431-43c1-bce3-405bb6b7f959@gmail.com","threadId":"63838","inReplyTo":"xmqqwm7xxn4a.fsf@gitster.g","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2025-07-25T14:02:22Z","receivedAt":"2025-07-25T14:02:26Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 24/07/2025 23:03, Junio C Hamano wrote:\n> Cameron Steffen <cam.steffen94@gmail.com> writes:\n> \n>> Sometimes I run into a conflict in a rebase and I end up resolving the\n>> conflict by removing all the changes. Then when I run `git rebase\n>> --continue`, the current commit is skipped and the rebase continues\n>> normally. Would it be possible to emit a message showing that the\n>> commit was skipped in this case? It isn't very obvious to me in my\n>> workflow that that is what occurred.\n> \n> I do not know what level of verbosity is needed to grab attention by\n> the end user, but something like this might be a good starting\n> point?\n> \n> Totally untested, and there may be implications (like, control\n> passes this point in different situations where the messages is not\n> warranted).\n\nI haven't tested it but I suspect this prints the warning when \ncontinuing after a \"break\" command or a failed \"exec\" command. That is \nprobably a good place to issue such a message but we'd want to check \nwhether rebase_path_message() exists before printing the message. I \nthink we could also read REBASE_HEAD to find out which commit we're \nskipping if we wanted to make the message a bit more informative.\n\nIt would mean that \"rebase --skip\" also prints this warning but I think \nthat is sensible if we're doing it for \"rebase --continue\" after \nremoving all the uncommitted changes from the worktree.\n\nThanks\n\nPhillip\n\n> I'll pick a few people from\n> \n>      git shortlog --since=2.years --no-merges sequencer.c\n> \n> based on their contribution to the file (not counting the internal\n> implementation changes) and Cc them to see if they have ideas.\n> \n> Thanks.\n> \n>   sequencer.c | 2 ++\n>   1 file changed, 2 insertions(+)\n> \n> diff --git c/sequencer.c w/sequencer.c\n> index 67e4310edc..677d6105dd 100644\n> --- c/sequencer.c\n> +++ w/sequencer.c\n> @@ -5369,6 +5369,8 @@ static int commit_staged_changes(struct repository *r,\n>   \t\t\tgoto out;\n>   \t\t}\n>   \n> +\t\twarning(_(\"omitting a step that has become empty\"));\n> +\n>   \t\tif (!final_fixup) {\n>   \t\t\tret = 0;\n>   \t\t\tgoto out;\n> \n\n"},{"id":"522746","messageId":"CAAVFnN=q5nCD3K1jppVcq7qB9P5WX0M070jqR_rey2hzBt0ERA@mail.gmail.com","threadId":"63838","inReplyTo":"184ec60f-9431-43c1-bce3-405bb6b7f959@gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2025-07-25T14:14:36Z","receivedAt":"2025-07-25T14:14:49Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"There is already a message that prints in the case where a commit is\nautomatically skipped if the changes are already applied.\n\n> warning: skipped previously applied commit <hash>\n\nPotentially we could use the very same message.\n\nOn Fri, Jul 25, 2025 at 9:02 AM Phillip Wood <phillip.wood123@gmail.com> wrote:\n>\n> On 24/07/2025 23:03, Junio C Hamano wrote:\n> > Cameron Steffen <cam.steffen94@gmail.com> writes:\n> >\n> >> Sometimes I run into a conflict in a rebase and I end up resolving the\n> >> conflict by removing all the changes. Then when I run `git rebase\n> >> --continue`, the current commit is skipped and the rebase continues\n> >> normally. Would it be possible to emit a message showing that the\n> >> commit was skipped in this case? It isn't very obvious to me in my\n> >> workflow that that is what occurred.\n> >\n> > I do not know what level of verbosity is needed to grab attention by\n> > the end user, but something like this might be a good starting\n> > point?\n> >\n> > Totally untested, and there may be implications (like, control\n> > passes this point in different situations where the messages is not\n> > warranted).\n>\n> I haven't tested it but I suspect this prints the warning when\n> continuing after a \"break\" command or a failed \"exec\" command. That is\n> probably a good place to issue such a message but we'd want to check\n> whether rebase_path_message() exists before printing the message. I\n> think we could also read REBASE_HEAD to find out which commit we're\n> skipping if we wanted to make the message a bit more informative.\n>\n> It would mean that \"rebase --skip\" also prints this warning but I think\n> that is sensible if we're doing it for \"rebase --continue\" after\n> removing all the uncommitted changes from the worktree.\n>\n> Thanks\n>\n> Phillip\n>\n> > I'll pick a few people from\n> >\n> >      git shortlog --since=2.years --no-merges sequencer.c\n> >\n> > based on their contribution to the file (not counting the internal\n> > implementation changes) and Cc them to see if they have ideas.\n> >\n> > Thanks.\n> >\n> >   sequencer.c | 2 ++\n> >   1 file changed, 2 insertions(+)\n> >\n> > diff --git c/sequencer.c w/sequencer.c\n> > index 67e4310edc..677d6105dd 100644\n> > --- c/sequencer.c\n> > +++ w/sequencer.c\n> > @@ -5369,6 +5369,8 @@ static int commit_staged_changes(struct repository *r,\n> >                       goto out;\n> >               }\n> >\n> > +             warning(_(\"omitting a step that has become empty\"));\n> > +\n> >               if (!final_fixup) {\n> >                       ret = 0;\n> >                       goto out;\n> >\n>\n"},{"id":"522748","messageId":"xmqq5xfg5o5j.fsf@gitster.g","threadId":"63838","inReplyTo":"CAAVFnN=q5nCD3K1jppVcq7qB9P5WX0M070jqR_rey2hzBt0ERA@mail.gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-25T14:40:56Z","receivedAt":"2025-07-25T14:40:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Cameron Steffen <cam.steffen94@gmail.com> writes:\n\n> There is already a message that prints in the case where a commit is\n> automatically skipped if the changes are already applied.\n>\n>> warning: skipped previously applied commit <hash>\n>\n> Potentially we could use the very same message.\n\nYes, that sounds like going in the right direction.\n\nBut only if we can positively tell the reason why there is no change\nrelative to the parent commit _is_ because the commit we are\ncurrently picking has already been applied, that is.\n\nI am not sure how you determine that, especially after giving\ncontrol back the end user upon conflict.\n\nThanks.\n"},{"id":"522751","messageId":"CAAVFnN=S-bu1FNafyyH797AeBxUu+8vk5yJ5xaxCUBkBZin_6w@mail.gmail.com","threadId":"63838","inReplyTo":"xmqq5xfg5o5j.fsf@gitster.g","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2025-07-25T15:20:45Z","receivedAt":"2025-07-25T15:20:59Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"> But only if we can positively tell the reason why there is no change\nrelative to the parent commit _is_ because the commit we are\ncurrently picking has already been applied, that is.\n\nI thought we merely would need to see that there are no staged changes\nto be committed, and there is a currently-picking commit that will now\nbe skipped? I don't need to know whether the commit was already\napplied. I just want to know that the commit in the rebase plan is not\nbeing committed.\n\nOn Fri, Jul 25, 2025 at 9:40 AM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Cameron Steffen <cam.steffen94@gmail.com> writes:\n>\n> > There is already a message that prints in the case where a commit is\n> > automatically skipped if the changes are already applied.\n> >\n> >> warning: skipped previously applied commit <hash>\n> >\n> > Potentially we could use the very same message.\n>\n> Yes, that sounds like going in the right direction.\n>\n> But only if we can positively tell the reason why there is no change\n> relative to the parent commit _is_ because the commit we are\n> currently picking has already been applied, that is.\n>\n> I am not sure how you determine that, especially after giving\n> control back the end user upon conflict.\n>\n> Thanks.\n"},{"id":"522752","messageId":"xmqqbjp847jy.fsf@gitster.g","threadId":"63838","inReplyTo":"184ec60f-9431-43c1-bce3-405bb6b7f959@gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-25T15:24:49Z","receivedAt":"2025-07-25T15:26:03Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> probably a good place to issue such a message but we'd want to check\n> whether rebase_path_message() exists before printing the message. I\n\nAh, such a test intuitively feels correct.  We are not creating a\ncommit, yet, we have message from the iteration being polished to\nuse when we do create one, which is about to be lost.  The user\ndeserves to be notified of the lossage.\n\n> think we could also read REBASE_HEAD to find out which commit we're\n> skipping if we wanted to make the message a bit more informative.\n>\n> It would mean that \"rebase --skip\" also prints this warning but I\n> think that is sensible if we're doing it for \"rebase --continue\" after\n> removing all the uncommitted changes from the worktree.\n\nWould --skip even pass this spot in the code by calling\ncommit_staged_changes()?\n\nI am not intimately familiar with the way how the sequencer code is\norganized, and am navigating largely by guesses on names of\nfunctions and variables (iow, I didn't check).\n\nThanks.\n\n>\n> Thanks\n>\n> Phillip\n>\n>> I'll pick a few people from\n>>      git shortlog --since=2.years --no-merges sequencer.c\n>> based on their contribution to the file (not counting the internal\n>> implementation changes) and Cc them to see if they have ideas.\n>> Thanks.\n>>   sequencer.c | 2 ++\n>>   1 file changed, 2 insertions(+)\n>> diff --git c/sequencer.c w/sequencer.c\n>> index 67e4310edc..677d6105dd 100644\n>> --- c/sequencer.c\n>> +++ w/sequencer.c\n>> @@ -5369,6 +5369,8 @@ static int commit_staged_changes(struct repository *r,\n>>   \t\t\tgoto out;\n>>   \t\t}\n>>   +\t\twarning(_(\"omitting a step that has become empty\"));\n>> +\n>>   \t\tif (!final_fixup) {\n>>   \t\t\tret = 0;\n>>   \t\t\tgoto out;\n>> \n"},{"id":"522780","messageId":"xmqq5xff3jhc.fsf@gitster.g","threadId":"63838","inReplyTo":"CAAVFnN=S-bu1FNafyyH797AeBxUu+8vk5yJ5xaxCUBkBZin_6w@mail.gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-07-26T00:04:47Z","receivedAt":"2025-07-26T00:04:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Cameron Steffen <cam.steffen94@gmail.com> writes:\n\n>> But only if we can positively tell the reason why there is no change\n> relative to the parent commit _is_ because the commit we are\n> currently picking has already been applied, that is.\n>\n> I thought we merely would need to see that there are no staged changes\n> to be committed, and there is a currently-picking commit that will now\n> be skipped? I don't need to know whether the commit was already\n> applied. I just want to know that the commit in the rebase plan is not\n> being committed.\n\nThen your earlier idea to reuse the same message\n\n>> warning: skipped previously applied commit <hash>\n>\n> Potentially we could use the very same message.\n\nwould not work, would it?\n"},{"id":"522782","messageId":"CAAVFnNmqGwGEddSv9CbWQGx_pyhY4aGMWj5fKN+7TQo6N6CyYQ@mail.gmail.com","threadId":"63838","inReplyTo":"xmqq5xff3jhc.fsf@gitster.g","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2025-07-26T02:40:25Z","receivedAt":"2025-07-26T02:40:38Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"I see what you mean now. I guess I did not consider the meaning of\nthat message very closely.\n\nOn Fri, Jul 25, 2025 at 7:04 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Cameron Steffen <cam.steffen94@gmail.com> writes:\n>\n> >> But only if we can positively tell the reason why there is no change\n> > relative to the parent commit _is_ because the commit we are\n> > currently picking has already been applied, that is.\n> >\n> > I thought we merely would need to see that there are no staged changes\n> > to be committed, and there is a currently-picking commit that will now\n> > be skipped? I don't need to know whether the commit was already\n> > applied. I just want to know that the commit in the rebase plan is not\n> > being committed.\n>\n> Then your earlier idea to reuse the same message\n>\n> >> warning: skipped previously applied commit <hash>\n> >\n> > Potentially we could use the very same message.\n>\n> would not work, would it?\n"},{"id":"522783","messageId":"553bd772-a92c-4782-a7aa-3092b3aa0494@kdbg.org","threadId":"63838","inReplyTo":"CAAVFnN=S-bu1FNafyyH797AeBxUu+8vk5yJ5xaxCUBkBZin_6w@mail.gmail.com","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2025-07-26T07:00:35Z","receivedAt":"2025-07-26T07:00:53Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 25.07.25 um 17:20 schrieb Cameron Steffen:\n>> But only if we can positively tell the reason why there is no change\n>> relative to the parent commit _is_ because the commit we are\n>> currently picking has already been applied, that is.\n> \n> I thought we merely would need to see that there are no staged changes\n> to be committed, and there is a currently-picking commit that will now\n> be skipped? I don't need to know whether the commit was already\n> applied. I just want to know that the commit in the rebase plan is not\n> being committed.\n\nHow would rebase know what I did while I had control? I could have fixed\nthe conflicts and committed manually. I could have reset to a different\ncommit. I could have split the change into two commits. I could have\nremoved the changes. I could have made additional changes. Possibilities\nare unlimited. Saying something like \"commit 123abc is now empty\" or \"is\nskipped\" would be incorrect most of the time in my workflow.\n\n-- Hannes\n\n"},{"id":"522797","messageId":"CAAVFnNk5YO7J_M8JoOiTMUBRsHQyXLtRPrwT=xSeovQMgT=+ew@mail.gmail.com","threadId":"63838","inReplyTo":"553bd772-a92c-4782-a7aa-3092b3aa0494@kdbg.org","subject":"Re: Show skipped commit message after rebase conflict?","fromName":"Cameron Steffen","fromEmail":"cam.steffen94@gmail.com","sentAt":"2025-07-26T15:00:04Z","receivedAt":"2025-07-26T15:00:17Z","isPatch":false,"sender":{"key":"cam.steffen94@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5565418?v=4"},"body":"> I could have fixed the conflicts and committed manually.\n\nI believe we can detect any case where you ran `git commit`. I just\nknow that when you run git commit in that case the commit message is\n_not_ auto populated from the pending commit. So git seems to be aware\nif you did any commit that \"replaces\" the pending commit. So I think\nthat addresses most of the cases you mentioned. As long as the first\n`git commit` after pausing from conflicts is non-empty, we can say the\npending commit is not \"skipped\".\n\n> I could have reset to a different commit.\n\nI think it would be okay to emit the message if you hard reset and continue.\n\nOn Sat, Jul 26, 2025 at 2:00 AM Johannes Sixt <j6t@kdbg.org> wrote:\n>\n> Am 25.07.25 um 17:20 schrieb Cameron Steffen:\n> >> But only if we can positively tell the reason why there is no change\n> >> relative to the parent commit _is_ because the commit we are\n> >> currently picking has already been applied, that is.\n> >\n> > I thought we merely would need to see that there are no staged changes\n> > to be committed, and there is a currently-picking commit that will now\n> > be skipped? I don't need to know whether the commit was already\n> > applied. I just want to know that the commit in the rebase plan is not\n> > being committed.\n>\n> How would rebase know what I did while I had control? I could have fixed\n> the conflicts and committed manually. I could have reset to a different\n> commit. I could have split the change into two commits. I could have\n> removed the changes. I could have made additional changes. Possibilities\n> are unlimited. Saying something like \"commit 123abc is now empty\" or \"is\n> skipped\" would be incorrect most of the time in my workflow.\n>\n> -- Hannes\n>\n"}]}