Skip to content

A command-line tool that helps you clean up Git branches that have been merged into master OR are older than the days you specify.

License

Notifications You must be signed in to change notification settings

rod-dot-codes/git-sweep-merged-and-stale

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

Git Sweep Merged and Stale Github Action

Delete merged and stale branches from a Github repository.

See example Preview and Cleanup step.

You need to use Python 3.6+ and declare it before

uses: actions/setup-python@v2
with:
    python-version: '3.x'
    architecture: 'x64'
This deletes branches that fulfil either of these:
  • Merged into Master or Main (specified by which_master_main) OR
  • Branches older than X days (specified by delete_stale_after_days)

This by default does not actually delete until you set parameter action = cleanup

The following branches are not deleted by default:
  • main
  • develop
  • master
WARNING: When you delete branches with no active PR,
you will lose access to the ability to restore the branch.
Please back it up using Github Artifacts or
a copy of the branch prior to running this.

Read the Python Readme . PyPi version available for PIP.

Based off git-sweep .

MIT License.

About

A command-line tool that helps you clean up Git branches that have been merged into master OR are older than the days you specify.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.8%
  • Shell 1.2%