Keep repos clean
Full Lesson Reference
Repos accumulate junk. Old drafts, test files, abandoned experiments, stale branches. A monthly 10-minute clean-up keeps GitHub useful and fast. This lesson is the clean-up routine.
Signs your repo needs a clean
- You've forgotten what half the folders are for
- Pages repo has old reports you never deleted (still publicly accessible)
- Workspace has projects in working/ that ended months ago
- Lots of branches with no active work on them
- Commit history is full of "fix typo" and "wip" messages
Monthly clean-up checklist
- Archive finished projects
In your workspace repo, move finished projects from working/ to archive/:
List all projects in working/. For each, tell me when it was last touched based on
terminalgit commit history. Flag anything that hasn't had activity in 60+ days as an archive
candidate.
Claude shows you a list. For ones to archive
Move [project-name] from working/ to archive/. Commit the move with a descriptive message.
- Clean old deliverables from Pages repo Old reports in your Pages repo are still publicly accessible (or encryption-accessible) forever unless you delete them.
List all files in my Pages repo public-encrypted/ folder grouped by date. Flag anything older than 6 months that's still publishing.
For client deliverables that are no longer relevant
Delete [old-report-path] from my Pages repo. Commit the deletion.
Deleted files stop publishing - URLs 404. Good for outdated content you don't want clients stumbling onto.
- Delete stale branches
Branches accumulate. After a while you have 10 branches and no idea which are active.
Show me all branches in my workspace repo. For each, tell me the last commit date and whether it's been merged. Flag merged branches for deletion. Delete all merged branches except main.
Keeps the branch list focused on actual active work.
- Squash commits on long-running branches
If you've got a branch with 20 commits of "fix typo" / "tweak copy", squash them into a few meaningful commits before merging:
Squash the commits on [branch] into a clean 2-3 commit history before I merge.
Claude rewrites the history. Merged result has cleaner commit log.
- Review .gitignore
.gitignore tells git which files to never track. It grows over time as you use the repo for different things.
Review my .gitignore. Is .env listed? Any obvious additions I'm missing like /tmp/, node_modules/, .DS_Store? Claude suggests additions based on what it finds in the repo.
What NOT to delete
- Anything in archive/ - that's your historical record. Cheap to keep, useful when a client asks "what did we do in Q2 last year?"
- Main branch - obvious but worth stating.
- Production deliverables that are still being referenced - check with Claude before deleting anything a client might still link to.
- Commit history - don't rewrite history on main unless you know exactly what you're doing.
Pre-emptive hygiene
Build habits that keep the repo clean as you go
- Move projects to archive/ the day they finish - not 6 months later when you've forgotten what they were
- Name branches descriptively - client-acme-q2 not new-branch-4
- Delete the branch after merging - many git setups do this automatically
- Write descriptive commit messages - future-you reading git log will thank you
- Keep secrets out of commits - always, every time, no exceptions
When you find a committed secret
Despite all the discipline, it happens. You accidentally commit a file with an API key or password.
Recovery
I accidentally committed a secret in [file]. Help me remove it from git history and rotate the credential.
Claude walks you through
- Identifying exactly what was committed
- Removing it from history (rewrite with git filter-br anch or similar)
- Rotating the credential on the original platform (since it's been exposed)
- Updating your .env with the new credential
- Force-pushing the cleaned history
Speed matters - the longer a secret sits in public git history, the more likely a scraper finds it.
Action items
☐ Schedule a monthly 10-minute repo clean-up
☐ Move finished projects to archive/ the day they finish
☐ Delete merged branches regularly
☐ Review .gitignore periodically - especially when adding new tools
☐ If you ever commit a secret, rotate + clean history immediately
Module complete. Next: Module 08 - Connect your tools with MCPs.
Exercises
- Review the concepts covered in this lesson: Keep repos clean.
- Write down your key takeaway from this lesson.
- Practice running any commands or prompts mentioned above inside your terminal.