sync-master-clean-branches

Syncs master to origin, deletes merged local PR branches, and removes generated PDFs.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/raghavamohan/AnalyticMadhyasthDarshan --skill sync-master-clean-branches-raghavamohan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-master-clean-branches
Source: https://github.com/raghavamohan/AnalyticMadhyasthDarshan/tree/main/.cursor/skills/sync-master-clean-branches
Command: npx skills add https://github.com/raghavamohan/AnalyticMadhyasthDarshan --skill sync-master-clean-branches-raghavamohan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Returning a repository to a clean, up-to-date master state after finishing pull request work is error-prone: stale local branches accumulate, generated PDFs clutter the tree, and uncommitted changes can be lost by careless resets. This Skill performs the sync and cleanup with strict safety gates. ## Core Features & Use Cases - Fast-forward master sync: Switches to master and pulls with --ff-only only, stopping and reporting if the branch has diverged from origin/master. - Safe branch pruning: Deletes only local branches confirmed merged into master via git branch -d, excluding master, worktree-checked-out branches, and unmerged work. - Generated PDF cleanup: Removes every .pdf under Studies/ and Applications/ while preserving References/, tmp/, and all other content. - Use Case: After merging several study PRs, ask for a full sync and cleanup to return to origin/master, prune the merged PR branches, and clear generated study PDFs in one pass. ## Quick Start Sync my repository to origin/master, clean up merged local PR branches, and remove generated PDFs under Studies and Applications.

Frequently Asked Questions about sync-master-clean-branches

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely sync my local master branch with origin/master?

Switch to master and run git pull --ff-only origin master so the branch only fast-forwards. If master has diverged from origin/master, the sync stops and reports the divergence instead of resetting or rebasing.

How do I delete local Git branches that are already merged?

Run git fetch --prune, list candidates with git branch --merged master, then delete each with git branch -d. Branches not fully merged, including squash-merged or rebased ones, are reported rather than force-deleted.

What happens to uncommitted changes when switching to master?

Tracked changes or untracked files outside the repository-root tmp/ directory block the sync entirely. Untracked tmp/ files may be temporarily stashed with a recorded stash ID and restored afterward, but are never deleted.

Which PDF files get deleted during the cleanup?

Every .pdf file under the Studies/ and Applications/ directories is treated as generated output and removed, regardless of Git tracking. PDFs in References/, other worktrees, or anywhere else are preserved.

Why does the skill refuse to delete some branches?

It uses git branch -d rather than -D, so Git refuses deletion of branches not merged into master. Those branches are reported separately so you can decide whether their remaining commits are disposable.