threads / discuss / 60868

Supporting --no-edit for git rebase --continue

Subject: Supporting --no-edit for git rebase --continue

## tl;dr

4 messages between Feb 7, 2024 and Feb 9, 2024.

replies: 3people: 3as markdown or json

Orgad Shaneh· Feb 7, 2024, 20:46 UTC · lore
Hi,

Is it possible to add --no-edit for git rebase --continue, similar to the functionality of this flag for git cherry-pick --continue and similar commands?

This should continue the rebase without activating the commit message editor, and just keep the existing message.

Thanks,
- Orgad
brian m. carlson· Feb 9, 2024, 01:38 UTC · re: Orgad Shaneh · lore

Re: Supporting --no-edit for git rebase --continue

On 2024-02-07 at 20:46:16, Orgad Shaneh wrote:
Show 5 quoted lines
> Hi,
> 
> Is it possible to add --no-edit for git rebase --continue, similar to
> the functionality of this flag for git cherry-pick --continue and
> similar commands?

I haven't checked whether this is actually possible, but I imagine it is with some work. I think it would be a valuable feature to add, but I don't think anyone's planning on working on it. Would you be willing to send a patch? Even if many people think it's a good idea, we're all busy, and thus it'll only be implemented if someone is willing to pick it up.

In the meantime, you could try setting `GIT_EDITOR=:` in your environment (for example, using an alias) like so:

[alias]
  rncontinue = "!f() { GIT_EDITOR=: git rebase --continue; };f"
and that can serve as a workaround.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Orgad Shaneh· Feb 9, 2024, 13:35 UTC · re: brian m. carlson · lore

Re: Supporting --no-edit for git rebase --continue

On Fri, Feb 9, 2024 at 3:38 AM brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 14 quoted lines
>
> On 2024-02-07 at 20:46:16, Orgad Shaneh wrote:
> > Hi,
> >
> > Is it possible to add --no-edit for git rebase --continue, similar to
> > the functionality of this flag for git cherry-pick --continue and
> > similar commands?
>
> I haven't checked whether this is actually possible, but I imagine it is
> with some work.  I think it would be a valuable feature to add, but I
> don't think anyone's planning on working on it.  Would you be willing to
> send a patch?  Even if many people think it's a good idea, we're all
> busy, and thus it'll only be implemented if someone is willing to pick
> it up.
Thank you. I'll try to prepare a patch.
Show 7 quoted lines
> In the meantime, you could try setting `GIT_EDITOR=:` in your
> environment (for example, using an alias) like so:
>
> [alias]
>   rncontinue = "!f() { GIT_EDITOR=: git rebase --continue; };f"
>
> and that can serve as a workaround.
Nice, thanks!
- Orgad
Phillip Wood· Feb 9, 2024, 16:16 UTC · re: Orgad Shaneh · lore

Re: Supporting --no-edit for git rebase --continue

Hi Orgad
On 07/02/2024 20:46, Orgad Shaneh wrote:
Show 8 quoted lines
> Hi,
> 
> Is it possible to add --no-edit for git rebase --continue, similar to
> the functionality of this flag for git cherry-pick --continue and
> similar commands?
> 
> This should continue the rebase without activating the commit message
> editor, and just keep the existing message.

I think being able to say "git rebase --continue --no-edit" to stop rebase prompting for a commit message when resolving a conflict would be useful but it would need to be careful that it did not suppress the editor for "reword", "squash", or "fixup" commands. You can use an alias that only runs the editor if HEAD has changed since the rebase was continued to do this

     git config alias.rbc-no-edit '!
         no_edit_head=$(git show-ref -s --verify HEAD) &&
         real_editor="$(git var GIT_EDITOR)" &&
         GIT_EDITOR="test \"\$(git show-ref -s --verify HEAD)\" = \"$no_edit_head\" || \
             $real_editor" git rebase --continue'
Best Wishes
Phillip

← back to recent threads