fix(git): guard remote branch deletion and skip applied cherry-picks

- Delete a remote branch only when the upstream (read from
  branch.<name>.remote and branch.<name>.merge) has the same name;
  otherwise refuse with REMOTE_BRANCH_MISMATCH before deleting anything.
- Without force, require the branch to be merged into HEAD before
  deleting its remote branch, so pushed unmerged commits are not lost.
- Cherry-pick integration selects only commits not yet applied to the
  target and skips merge commits.
- Create worktrees from a remote-only base as origin/<branch>.
- Show the upstream name in the branch delete dialog and update the
  worktree delete option text and git docs.
This commit is contained in:
Chris Scott committed 2026-10-03 22:51:03 -04:00
1 parent 53238a6324
commit 84e14c4600
10 files changed
+231 -25

No files matched your search

+1
View File
@@ -14,6 +14,7 @@ export type GitErrorCode =
| 'BRANCH_CHECKED_OUT'
| 'BRANCH_IN_OTHER_WORKTREE'
| 'BRANCH_NOT_MERGED'
| 'REMOTE_BRANCH_MISMATCH'
| 'STASH_CHANGED'
| 'UNCOMMITTED_CHANGES'
| 'NO_OPERATION_IN_PROGRESS'