-
Notifications
You must be signed in to change notification settings - Fork 1
chore: add post-merge-cleanup skill #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||||||||||
| # Post-Merge Cleanup | ||||||||||||||
|
|
||||||||||||||
| Run this after squash-merging a PR to clean up the local repo. | ||||||||||||||
|
|
||||||||||||||
| ## Steps | ||||||||||||||
|
|
||||||||||||||
| 1. Switch to main and pull latest: | ||||||||||||||
| ```bash | ||||||||||||||
| git checkout main && git pull | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| 2. Prune remote tracking branches that no longer exist on the remote: | ||||||||||||||
| ```bash | ||||||||||||||
| git fetch --prune | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| 3. Delete local branches whose remote tracking branch is gone: | ||||||||||||||
| ```bash | ||||||||||||||
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -D | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of
Suggested change
|
||||||||||||||
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -D | |
| git for-each-ref --format='%(refname:short) %(upstream:track)' refs/heads | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -D |
Copilot
AI
Feb 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xargs -r is a GNU extension and will fail on macOS/BSD xargs. Since this is a cross-platform repo workflow, consider rewriting the command to avoid -r (e.g., a shell loop that only runs git branch -d/-D when there are matches) so the step works consistently.
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -D | |
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | while read -r branch; do git branch -D "$branch"; done |
Copilot
AI
Feb 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step force-deletes branches with git branch -D, which can discard local-only commits even if the remote tracking branch is gone (e.g., someone deleted the remote branch before you pushed). To reduce the chance of accidental data loss, consider using a safe delete first (-d) and only instructing -D after confirming the branch can be dropped.
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -D | |
| ``` | |
| If no gone branches exist, skip this step. | |
| git branch -vv | grep '\[.*: gone\]' | awk '{print $1}' | xargs -r git branch -d |
If git branch -d refuses to delete a branch, inspect it first; only use git branch -D <branch> if you're sure its commits can be discarded. If no gone branches exist, skip this step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skill file doesn’t include the YAML frontmatter metadata (e.g.,
description,argument-hint,allowed-tools) that the other skill in.claude/skills/uses. Without it, tooling that indexes/validates skills may not pick up the skill consistently; consider adding a frontmatter block consistent with.claude/skills/aurelio-review-pr/skill.md.