You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 fix: use git show-branch for clearer SSH workspace force delete errors (#530)
## Problem
When attempting to delete SSH workspaces with unpushed commits, the
current error message uses `git log --branches --not --remotes` which
just lists commits without context. This is especially confusing in
squash-merge workflows where feature branch commits never appear in
main, so they always show as "unpushed" even after the PR is merged.
## Solution
Replace the git log command with `git show-branch <current-branch>
origin/<default-branch>` to show the relationship between branches
visually.
**Before:**
```
5d307e9 feat: add feature work 2
5e195dd feat: add feature work 1
```
**After:**
```
Branch status compared to origin/main:
* [feature-branch] feat: add feature work 2
! [origin/main] feat: add all feature work (squashed)
--
* [origin/main] feat: add all feature work (squashed)
+ [feature-branch] feat: add feature work 2
+ [feature-branch^] feat: add feature work 1
+* [origin/main^] Initial commit
Note: If your PR was squash-merged, these commits are already
in origin/main and safe to delete.
```
The `+`, `*`, and `+*` markers clearly show which commits are in which
branch, making it immediately obvious when dealing with a squash-merge
scenario.
## Implementation
- Detects default branch using `git symbolic-ref
refs/remotes/origin/HEAD` with fallbacks to main/master
- Uses `git show-branch` to display branch relationships
- Falls back to original `git log` command when:
- No remote branches exist
- Default branch cannot be determined
- show-branch fails for any reason
This ensures backward compatibility while providing better UX in the
common case.
## Testing
All existing integration tests pass, including the test that validates
error messages contain commit information.
_Generated with `cmux`_
0 commit comments