EliasOulkadi/shokunin / .pack/skills/git-workflow
git-workflow
VerifiedAutomate the complete Git development workflow — create feature branches with conventional naming, atomic commits with conventional commit messages, interactive rebase, squash merges, PR body generation from commit history, branch cleanup, and git worktree patterns. Use when user asks to create a branch, commit changes, make a PR, rebase, squash, clean up branches, or follow a Git workflow. Do NOT use for CI/CD pipeline configuration (use ci-cd), code review (use code-review), or GitHub Actions workflows.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.5 KB |
| references/branch-strategy.md | markdown | 6.6 KB |
| references/git-workflows.md | markdown | 7.1 KB |
| scripts/auto-commit.ps1 | script | 5.5 KB |
| scripts/cleanup-branches.ps1 | script | 3.6 KB |
| scripts/create-feature-branch.ps1 | script | 2.7 KB |
| scripts/pr-body.ps1 | script | 7.4 KB |
scripts/cleanup-branches.ps1
View on GitHub<#
.SYNOPSIS
Deletes local and remote branches that have been merged.
.DESCRIPTION
Lists all merged branches (excluding main/master/develop),
asks for confirmation, then deletes them locally and remotely.
.PARAMETER Force
Skip confirmation prompt.
.PARAMETER Remote
Also delete remote tracking branches (default: $true).
.PARAMETER Exclude
Additional branch patterns to exclude (comma-separated).
.EXAMPLE
.\cleanup-branches.ps1
Shows merged branches and prompts before deleting.
.EXAMPLE
.\cleanup-branches.ps1 -Force
Deletes without prompting.
.EXAMPLE
.\cleanup-branches.ps1 -Remote:$false
Only deletes local branches, leaves remote intact.
#>
param(
[switch]$Force,
[bool]$Remote = $true,
[string]$Exclude
)
$ErrorActionPreference = 'Stop'
$protected = @('main', 'master', 'develop')
if ($Exclude) {
$protected += $Exclude -split ','
}
# Disable pager to avoid hangs
$env:GIT_PAGER = 'cat'
function Get-MergedBranches {
$currentBranch = git rev-parse --abbrev-ref HEAD
$mergeBase = git merge-base HEAD $(git branch -r --merged | ForEach-Object { $_.Trim() } | Select-Object -First 1)
git branch --merged |
ForEach-Object { $_.Trim() } |
Where-Object {
$_ -and
$_ -notin $protected -and
$_ -ne $currentBranch -and
$_ -notmatch '^\*'
} |
Sort-Object
}
function Get-MergedRemoteBranches {
git branch -r --merged |
ForEach-Object { $_.Trim() } |
Where-Object {
$_ -match '^origin/(.+)$' -and
$matches[1] -notin $protected -and
$matches[1] -notmatch '^(HEAD|gh-pages)$'
} |
ForEach-Object { $_.Trim() } |
Sort-Object
}
function Confirm-AndDelete {
param([string[]]$Branches, [string]$Scope)
if (-not $Branches) {
Write-Host "No merged $Scope branches to clean up." -ForegroundColor Green
return
}
Write-Host "`nMerged $Scope branches:" -ForegroundColor Yellow
$Branches | ForEach-Object { Write-Host " - $_" }
if (-not $Force) {
$confirm = Read-Host "`nDelete these $($Branches.Count) $Scope branches? [y/N]"
if ($confirm -ne 'y') {
Write-Host "Skipped $Scope cleanup." -ForegroundColor Gray
return
}
}
$deleted = 0
$failed = 0
foreach ($branch in $Branches) {
try {
if ($Scope -eq 'local') {
git branch -d $branch 2>$null
} else {
git push origin --delete $branch 2>$null
}
if ($LASTEXITCODE -eq 0) {
Write-Host " [ok] $branch" -ForegroundColor Green
$deleted++
} else {
Write-Host " [!!] $branch (failed)" -ForegroundColor Red
$failed++
}
} catch {
Write-Host " [!!] $branch ($($_.Exception.Message))" -ForegroundColor Red
$failed++
}
}
Write-Host "`n$Scope: $deleted deleted, $failed failed" -ForegroundColor $(if ($failed -eq 0) { 'Green' } else { 'Red' })
}
Write-Host "=== Branch Cleanup ===" -ForegroundColor Cyan
# Fetch latest remote state
Write-Host "Fetching from origin..." -ForegroundColor Gray
git fetch --prune -q
$localMerged = Get-MergedBranches
Confirm-AndDelete -Branches $localMerged -Scope 'local'
if ($Remote) {
$remoteMerged = Get-MergedRemoteBranches
Confirm-AndDelete -Branches $remoteMerged -Scope 'remote'
}
# Prune local remote-tracking refs
Write-Host "`nPruning stale remote-tracking refs..." -ForegroundColor Gray
git remote prune origin -q
Write-Host "=== Cleanup complete ===" -ForegroundColor Cyan
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |