{"slug": "updating-dependent-branches-when-rebasing-automagically", "title": "Updating dependent branches when rebasing, automagically", "summary": "Git 2.38, released 2022-10-03, added `git rebase --update-refs`, which automatically updates dependent branches during a rebase, eliminating manual work. The feature was highlighted by Jamie Tanna, a contributor to Renovate, who noted that it saves significant time when rewriting commit messages across stacked PRs on GitHub.", "body_md": "I'm regularly rewriting my history, often with [the lens of improving my commit messages](https://www.jvt.me/posts/2026/08/17/hand-write-commits/).\n\nOn the [Renovate](https://docs.renovatebot.com/) project, we use a Merge Queue with Squash Merge, which means that if I do want to have atomic commits, I need to split them across PRs, which adds a bit of noise to manage them.\n\nAlternatively, I could bypass branch protection requirements to do a rebase merge, but that's the only way to do a rebase merge with a Merge Queue.\n\nNow that GitHub has launched [stacked PRs](https://github.github.com/gh-stack/), it's now possible to get this behaviour as I wanted, but with the safety of the Merge Queue.\n\nBut the issue is what happens when I've amended the commit message on one of the PRs, and now need to trigger a cascading rebase?\n\nAs of ~5 minutes ago, I would have to do that all manually, like a chump.\n\nIt turns out - thanks to a pointer from Claude Opus 5 - Git has had a capability to improve this for *years*! In [Git 2.38 (2022-10-03), git rebase --update-refs was added](https://github.blog/open-source/git/highlights-from-git-2-38/#rebase-dependent-branches-with-update-refs), which allows doing exactly this, but without any of the manual work.\n\nFor instance, if we run `git rebase -i origin/HEAD --update-refs`\n\n, we'll get a prompt in our `$EDITOR`\n\nlike so:\n\n```\npick 5c02d5df35 # fix(platform/bitbucket): remove support for Issues\nupdate-ref refs/heads/fix/bitbucket-cloud-issues-removed\npick 8dd04828d3 # feat(http/bitbucket): surface deprecated and removed API functionality\nupdate-ref refs/heads/feat/bitbucket-surface-api-deprecations\npick e7c9902237 # refactor(http): add a `handleResponse` hook\nupdate-ref refs/heads/refactor/http-handle-response-hook\npick b989428159 # feat(http/bitbucket): warn when an endpoint announces a deprecation\n# Rebase 7d7f286dc8..b989428159 onto 7d7f286dc8 (7 commands)\n#\n# Commands:\n# ...\n# u, update-ref <ref> = track a placeholder for the <ref> to be updated\n# to this position in the new commits. The <ref> is\n# updated at the end of the rebase\n# ...\n```\n\nThis then handles the updating of all the commits on relevant branches - a massive time saver!", "url": "https://wpnews.pro/news/updating-dependent-branches-when-rebasing-automagically", "canonical_source": "https://www.jvt.me/posts/2026/08/25/git-rebase-update-refs/?utm_medium=rss&utm_source=rss", "published_at": "2026-08-25 13:56:12+00:00", "updated_at": "2026-08-25 14:42:43.897494+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Git", "Renovate", "GitHub", "Claude Opus 5", "Jamie Tanna"], "alternates": {"html": "https://wpnews.pro/news/updating-dependent-branches-when-rebasing-automagically", "markdown": "https://wpnews.pro/news/updating-dependent-branches-when-rebasing-automagically.md", "text": "https://wpnews.pro/news/updating-dependent-branches-when-rebasing-automagically.txt", "jsonld": "https://wpnews.pro/news/updating-dependent-branches-when-rebasing-automagically.jsonld"}}