Skip to content

Lock branches held by git state outside the branch list - #7

Merged
skunkworker merged 1 commit into
masterfrom
jb/2026_10_09_held_branches
Oct 10, 2026
Merged

skunkworker merged 1 commit into
masterfrom
jb/2026_10_09_held_branches

Conversation

@skunkworker

Copy link
Copy Markdown
Owner

git keeps state outside refs/heads that changes what a delete does. This follows #6 (linked worktrees) with four more cases. Each one was reproduced in a throwaway repo first.

  • Rebase, bisect, rebase --update-refs: git refuses -d and -D on the branches they hold. Those branches now show ~ and are locked.
  • r wrong target: r could arm the delete of a protected or default upstream, or of origin's branch for a local upstream. It now refuses and says why.
  • Fetch refspecs: remote rows now map back through remote.<name>.fetch. Before, a renaming refspec made the delete remove a teammate's branch.
  • Partial clones: cherry and diff can fetch, so they now get the network timeout. A cherry that fails offline no longer counts as zero risk.

Tests: 4 new, 105 in total, passing under -race. Each new test fails with its fix taken out.

🤖 Generated with Claude Code

git keeps state outside refs/heads that changes what a delete does.
The tool did not read it, as with linked worktrees before #6.

- A rebase, bisect or rebase --update-refs holds its branches, and git
  refuses -d and -D on them. They now show ~ and are locked.
- r could arm the delete of the wrong remote branch: a protected or
  default upstream, or origin's branch for a local upstream. It now
  refuses these and says why.
- Remote rows now map back through remote.<name>.fetch. A renaming
  refspec made the delete remove a teammate's branch of the same short
  name. Rows that map to no branch, or to more than one, are dropped.
- In a partial clone, cherry and diff can fetch, so they get the
  network timeout. A cherry that fails offline no longer counts as
  zero risk, so x does not select an unmerged gone branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@skunkworker
skunkworker merged commit ef3e9b7 into master Oct 10, 2026
2 checks passed
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.

1 participant