PR to Main Cleanup
Delete merged feature branches after PR is merged to main.
Workflow
-
Gather context (parallel):
git branchto identify current branchgit log --oneline -1to confirm current state
-
Execute cleanup:
- Switch to main branch
- Pull latest changes from origin
- Delete local feature branch
- Delete remote feature branch
Commands
git checkout main && git pull origin main && git branch -D <branch-name> && git push origin --delete <branch-name>
Important Notes
- PRs to main are always squash-merged, so use
-D(force delete) since git cannot detect squash merges as "merged" - Always pull latest main before deleting to sync merge status