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

+6
View File
@@ -183,6 +183,12 @@ const ERROR_PATTERNS: ErrorPattern[] = [
/is not fully merged/i,
],
},
{
code: 'REMOTE_BRANCH_MISMATCH',
summary: "The branch's upstream has a different name, so its remote branch was not deleted.",
statusCode: 409,
patterns: [],
},
{
code: 'STASH_CHANGED',
summary: 'The stash list changed. Refresh and try again.',