ワンクリックで
clean-local-branches
Clean up local branches which have been merged into the default branch, and rebase unmerged branches.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Clean up local branches which have been merged into the default branch, and rebase unmerged branches.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | clean-local-branches |
| description | Clean up local branches which have been merged into the default branch, and rebase unmerged branches. |
This skill helps the user clean up local branches that have already been merged into the default branch (e.g., main or master) and rebases branches which have not.
main or master).git fetch --prune to update remote refs and remove stale remote tracking branches.For each local branch (excluding the default branch and other protected branches like develop):
git checkout <branch>git rebase <default>git rebase --abort) and note the branch as Conflict.git rev-parse HEAD vs git rev-parse <default>). If they match, the branch is Merged — all its commits were already applied, so rebase dropped them and the tip landed on the default branch. Otherwise, the branch is Rebased (it has commits on top of the default branch).Also note whether each branch has a remote tracking branch (i.e. origin/<branch> exists). This information is needed in Step 5.
Return to the default branch when done.
This approach reliably detects standard merges, squash merges, and cherry-picks, because rebase drops commits whose changes are already present in the default branch. As a bonus, unmerged branches get rebased onto the latest default branch.
Present the results in a clear table, for example:
| Branch | Status | Proposed Action |
|-----------------|----------|-----------------|
| feature/foo | Merged | Delete (local + remote) |
| feature/bar | Merged | Delete (local only) |
| bugfix/baz | Rebased | Force push |
| experiment/qux | Rebased | Keep (no remote) |
| hotfix/abc | Conflict | Keep (needs manual resolution) |
Ask the user to confirm which merged branches to delete.
git branch -D <branch>. If the branch also exists on the remote, delete it with git push origin --delete <branch>.git push --force-with-lease origin <branch>. If it does not exist on the remote, do nothing (do not push).