Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

SSH workspaces required force deletion after squash-merging PRs because the check used git log --branches --not --remotes which always shows commits for squash-merged branches (original commits differ from squash commit SHA).

Solution: Added content-based comparison when unpushed commits are detected:

  1. Fetch latest default branch from origin
  2. Get files changed on branch since merge-base
  3. Compare each file's content between HEAD and origin/$DEFAULT
  4. If all files match → treat as merged (squash-merge case, allow deletion)
  5. If files differ → genuinely unmerged work (require force)

This allows clean deletion of squash-merged branches without forcing, while still protecting branches with real uncommitted work.


Generated with mux

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@ammar-agent ammar-agent force-pushed the ssh-workspace-squash-deletion branch 8 times, most recently from 499a44e to 298a424 Compare December 2, 2025 19:40
SSH workspaces required force deletion after squash-merging PRs because
the check used 'git log --branches --not --remotes' which always shows
commits for squash-merged branches (original commits differ from the
squash commit SHA).

Added content-based comparison when unpushed commits are detected:
- Fetch latest default branch from origin
- Get files changed on branch since merge-base
- Compare each file's content between HEAD and origin/$DEFAULT
- If all files match, treat as merged (squash-merge case)

Also prefer origin/main or origin/master over origin/HEAD for default
branch detection, since origin/HEAD can point to feature branches in
some repo configurations.

Includes integration tests for both squash-merge detection and ensuring
genuinely unmerged content is still blocked.
@ammar-agent ammar-agent force-pushed the ssh-workspace-squash-deletion branch from 298a424 to b80e01f Compare December 2, 2025 19:40
@ammario ammario merged commit cc0c9df into main Dec 3, 2025
13 checks passed
@ammario ammario deleted the ssh-workspace-squash-deletion branch December 3, 2025 01:56
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.

2 participants