Git development
 help / color / mirror / Atom feed
* Programmatically edit the git rebase sequence?
@ 2026-07-03 12:02 Matthias Beyer
  2026-07-03 12:17 ` Michal Suchánek
  2026-07-03 13:42 ` brian m. carlson
  0 siblings, 2 replies; 5+ messages in thread
From: Matthias Beyer @ 2026-07-03 12:02 UTC (permalink / raw)
  To: git; +Cc: neikos

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

Hi git people,

in a recent conversation at work, the question of how to
programmatically edit the git-rebase sequence came up.

Example use case:

I have a branch that touches a number of files, adds some files and
removes some files.
When rebasing, I want to split all commits that touched a certain subset
of files, for the clearity of the history.

I look at the output of

    git log master..mybranch --oneline --diff-filter=M -- "./subdir/*.rs"

to find all commits in that subdir that only touched the files. All of
these commits are to be "edit"ed.

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 :-)

Maybe I am just not aware of the obvious solution - I would be happy to
learn that there is already one!

Best,
Matthias

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-03 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-07-03 15:31   ` D. Ben Knoble

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox