Skip to content

feat(rebase): update other local branches with --update-refs - #155

Merged
danielss-dev merged 2 commits into
mainfrom
developements/update-refs-rebase-c6bf
Oct 19, 2026
Merged

danielss-dev merged 2 commits into
mainfrom
developements/update-refs-rebase-c6bf

Conversation

@danielss-dev

@danielss-dev danielss-dev commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

First slice of DAN-88. Later slices (parent branch, sidebar grouping, restack indicator, stacked PRs) are not in this change.

Plain rebase and the interactive rebase editor can move other local branches whose tips sit in the rewritten range. The choice is remembered per repository as local rebase.updateRefs. The flag on a given call (--update-refs or --no-update-refs) wins over that setting. Git older than 2.38 disables the toggle, with a tooltip, instead of failing mid-rebase.

The plan shows which other local branches will move, and which will not because they are checked out in another worktree. The result toast lists the branches that actually moved. Refs move only when the rebase finishes. A conflict pause and Abort leave every ref where it was.

On the flat path the sequence editor is cat "$STRAND_REBASE_PLAN" >, which overwrites git's todo and would drop git's update-ref lines. Strand emits update-ref refs/heads/<name> itself, after the last kept commit that branch contained — after that step's reword amend and after a following squash or fixup chain. A dropped tip falls back to the previous kept ancestor, or to the rebase base when nothing it contained survives. Reordering does not adopt commits the branch never contained.

The preserve-merges awk editor prints unknown lines through, including update-ref and abbreviated u. That path passes --update-refs and does not emit a second copy.

Test plan

  • cargo test -p strand-core — plain rebase on and off, interactive reword on and off, drop/squash/reorder landing, worktree skip, conflict then abort then continue, preserve-merges passthrough
  • cargo test for strand-ops, strand-headless, strand-tauri, and strand-azdo
  • cargo clippy -p strand-core -p strand-tauri -p strand-ops -p strand-headless -p strand-azdo-protocol -p strand-azdo -- -D warnings
  • pnpm --filter ./ui test — toggle markup and planUpdateRefs

Review fixes

  • The toggle's choice is stored in Strand's own local key strand.rebaseUpdateRefs, not git's rebase.updateRefs. git pull --rebase and terminal rebases are no longer affected. Every Strand rebase still passes --update-refs / --no-update-refs explicitly.
  • Pull (decision): Daniels decided git pull --rebase should respect the user's own rebase.updateRefs setting. Strand doesn't pass or override it for pull (git pull doesn't accept --no-update-refs anyway), and since Strand no longer writes rebase.updateRefs, that setting is only ever the user's. No code change.
  • The choice is saved when the rebase starts, not on every checkbox click.
  • The editor's no-op check is restored (main's isNoop).
  • The plan_update_refs doc comment and the learning about reorders are corrected.
  • New tests:
    • the flat interactive path stops on a conflict, then abort restores every tip;
    • the same conflict, then continue moves the stacked branch;
    • the Strand key leaves rebase.updateRefs unset.

Merge order 157 → 153 → 155 → 154 → 156 → 158: #154, #156 and #158 build on the signatures here and will need adapting after this merges.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 19, 2026 16:46
Remember the choice per repo as local rebase.updateRefs. The flat
interactive sequence editor overwrites git's todo, so Strand emits
update-ref lines after the last kept commit each branch contained.
Preserve-merges passes git's own lines through. Git older than 2.38
disables the toggle instead of failing mid-rebase.

DAN-88

Co-authored-by: Daniels <danielss-dev@users.noreply.github.com>
…N-88)

- Remember the toggle in Strand's own local key strand.rebaseUpdateRefs
  instead of git's rebase.updateRefs, which also changed git pull
  --rebase and terminal rebases. Every Strand rebase still passes
  --update-refs / --no-update-refs explicitly.
- Save the choice when a rebase starts, not on every checkbox click.
- Restore the editor's no-op check: an unchanged all-pick plan no longer
  runs a do-nothing rebase just because branches sit in the range.
- Tests: flat interactive path (Strand-written update-ref lines) paused
  on a conflict, then aborted (all tips restored) or continued (the
  stacked branch moves); the Strand key leaves rebase.updateRefs unset.
- Correct the doc comment and learning about reorders.

Co-authored-by: Daniels <danielss-dev@users.noreply.github.com>
@danielss-dev
danielss-dev marked this pull request as ready for review October 19, 2026 14:46
@danielss-dev
danielss-dev force-pushed the developements/update-refs-rebase-c6bf branch from 20abe5b to 13ea268 Compare October 19, 2026 14:46
@danielss-dev
danielss-dev merged commit 43ca736 into main Oct 19, 2026
6 checks passed
danielss-dev pushed a commit that referenced this pull request Oct 19, 2026
Squashed for the rebase onto #155 and #154: journal, worktree and pushed-commit
guards, stale-entry removal, staged-path stdin, overlap guards.
danielss-dev added a commit that referenced this pull request Oct 19, 2026
Squashed for the rebase onto #155 and #154: journal, worktree and pushed-commit
guards, stale-entry removal, staged-path stdin, overlap guards.

Co-authored-by: Grok Bot <grokbot@users.noreply.github.com>
danielss-dev pushed a commit that referenced this pull request Oct 19, 2026
Squashed for the rebase onto #155, #154 and #156. Drag-rebase now opens the
same RebaseOntoDialog as the Rebase menu (with the --update-refs choice).
danielss-dev added a commit that referenced this pull request Oct 19, 2026
…#158)

Squashed for the rebase onto #155, #154 and #156. Drag-rebase now opens the
same RebaseOntoDialog as the Rebase menu (with the --update-refs choice).

Co-authored-by: Grok Bot <grokbot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants