Skip to main content

Overview

Clean Up Project Resources

Recommended

Remove obsolete backup files and stale Git branches while keeping your project organized and maintainable.

Commandcusty cleanup

Category

Maintenance

Quick Command

custy cleanup <subcommand>

maintenancecleanupgitbackups

Overview

The cleanup command removes resources that are no longer needed after regular development activities.

Custy currently supports two independent cleanup operations:

  • Backup Cleanup — removes older backup files while preserving the newest backups according to the configured retention policy.

  • Branch Cleanup — removes Git branches that match user-defined cleanup rules while protecting important branches such as main, master, and develop.

Although both operations belong to the same command family, they serve different purposes and have different safety characteristics.



Cleanup Types

Available Cleanup Operations

Backup Cleanup

Removes older backup files while keeping the most recent backups according to the configured retention policy.

Branch Cleanup

Removes stale Git branches that satisfy the configured cleanup filters while protecting important branches.

Automatic vs Manual Cleanup

Cleanup OperationAutomaticManualPurpose
Backup Cleanup✅ Yes✅ YesRemove old backup files.
Branch Cleanup❌ No✅ YesRemove obsolete Git branches.

Backup cleanup may execute automatically during certain Custy workflows.

Branch cleanup is intentionally performed manually because it modifies the Git repository.



Workflow Integration

Some cleanup operations can participate in workflow pipelines, while others are intentionally manual because they modify Git resources.

Backup cleanup is integrated into several Custy workflow pipelines and helps keep backup directories organized automatically.

Branch cleanup is intentionally excluded from automated release workflows and must be executed manually to avoid accidental branch removal.


Configuration Driven

Cleanup behavior is primarily controlled through your project's config.toml.

Examples of configurable behavior include:

  • Backup retention count.
  • Branch name prefixes.
  • Merge status filters.
  • Branch age filters.
  • Branch date filters.

This allows each project to define maintenance rules that match its own Git workflow.