threads / discuss / 63231

[ITCH] Redundant rebuilds when rebasing outdated branch

Subject: [ITCH] Redundant rebuilds when rebasing outdated branch

## tl;dr

2 messages between Apr 1, 2025 and Apr 1, 2025.

replies: 1people: 2as markdown or json

Ramkumar Ramachandra· Apr 1, 2025, 10:54 UTC · lore
Hi,
I've noticed a common pattern in my everyday work, and thought I should ask if I'm doing something stupid. I work on upstream LLVM, and develop patches on different branches based off 'main'. Due to the nature of our collaboration, I often need to update 'main' and rebase patches, when some patches land. As a consequence, different patches are based on different points of 'main', and I find myself checking out an outdated branch, rebasing it on top of 'main' (which often doesn't result in conflicts), and this triggers a rebuild because the timestamps changed. Since LLVM is a huge project, I use ccache to speed up my builds, but this doesn't solve the problem of redundant rebuilds, since CMake often needs to be reconfigured, and several built artifacts are generated using home-grown tools.
I think it would be preferable to have something like 'git rebase-checkout', which in principle, creates a new branch based off 'main', cherry-picks commits off the outdated branch, and renames the fresh branch into the outdated branch's name. It should be possible to script this using the existing plumbing, but I was wondering if something like this would be useful to have in core git?
Thanks.
Ram
brian m. carlson· Apr 1, 2025, 23:44 UTC · re: Ramkumar Ramachandra · lore

Re: [ITCH] Redundant rebuilds when rebasing outdated branch

On 2025-04-01 at 10:54:15, Ramkumar Ramachandra wrote:
> I think it would be preferable to have something like 'git rebase-checkout', which in principle, creates a new branch based off 'main', cherry-picks commits off the outdated branch, and renames the fresh branch into the outdated branch's name. It should be possible to script this using the existing plumbing, but I was wondering if something like this would be useful to have in core git?

I think `git replay` might do what you want. It operates as a non-interactive rebase which leaves the working tree and index untouched, and updates no references (although it's designed to be piped to `git update-ref --stdin`). It is experimental, though.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

← back to recent threads