Git development
 help / color / mirror / Atom feed
From: "Matt Hunter" <m@lfurio.us>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	"Matthias Beyer" <mail@beyermatthias.de>
Cc: <git@vger.kernel.org>, <neikos@neikos.email>
Subject: Re: Programmatically edit the git rebase sequence?
Date: Fri, 03 Jul 2026 10:33:14 -0400	[thread overview]
Message-ID: <DJP0D7IZJ8WX.S1DDPT3KTQ95@lfurio.us> (raw)
In-Reply-To: <ake8OAIyK-ELs-fU@fruit.crustytoothpaste.net>

On Fri Jul 3, 2026 at 9:42 AM EDT, brian m. carlson wrote:
> On 2026-07-03 at 12:02:33, Matthias Beyer wrote:
>> 
>> Now I fire up `git rebase -i master` and manually(!) match the list from
>> above `git-log` call and find the respective commits to edit them.
>> 
>> Is there a way I am not aware of to do that manual step programatically?
>> Something like
>> 
>>     git rebase -i master --edit-commits="$(git log master..mybranch --diff-filter=M --format="%H" -- "./subdir/*.rs")"
>> 
>> would be convenient here, although I would understand if that is too
>> much clutter for the already very heavy git CLI interface :-)
>
> Yes, such a thing exists.  You want `GIT_SEQUENCE_EDITOR`, which is an
> `EDITOR`-like command that edits the rebase list in place.  So tools
> like `ed`, `ex`, `sed -i`, `perl -i`, or `ruby -i` would be useful here.

Interesting tip - thanks!

>
> I personally use this alias, which explicitly does not edit the sequence
> list, to automatically squash in all squash and fixup commits without
> prompting:
>
>     srebase = "!f() { GIT_SEQUENCE_EDITOR=true git rebase -m -i --autosquash \"$@\"; };f"

'git rebase --autosquash' does work now without the need to invoke
--interactive mode.  I believe we got this with f8f87e082798
(Merge branch 'ak/rebase-autosquash')

  reply	other threads:[~2026-07-03 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 12:02 Programmatically edit the git rebase sequence? Matthias Beyer
2026-07-03 12:17 ` Michal Suchánek
2026-07-03 13:42 ` brian m. carlson
2026-07-03 14:33   ` Matt Hunter [this message]
2026-07-03 15:31   ` D. Ben Knoble

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DJP0D7IZJ8WX.S1DDPT3KTQ95@lfurio.us \
    --to=m@lfurio.us \
    --cc=git@vger.kernel.org \
    --cc=mail@beyermatthias.de \
    --cc=neikos@neikos.email \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox