Skip to content

letieu/git-branch-killer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Git Branch Deletion Script

This script (remove.mjs) helps you delete Git branches locally or remotely. Before using the script, please ensure that you have zx installed globally on your system.

Prerequisites

  • zx: Install zx globally using the following command:

    npm install -g zx

How to Use

  1. Clone the Git repository or download the script (remove.mjs) to your local system.

  2. Run the script using zx in your repository's root directory. For example:

    cd my-project
    zx /path/to/remove.mjs

Options

The script supports the following options:

  • --remote: Use this flag to delete remote branches instead of local branches. For example:

    zx /path/to/remove.mjs --remote
  • --exclude: You can exclude specific branches from deletion, by default the script will not delete the main, master, develop, development, and test branches. For example:

    zx /path/to/remove.mjs --exclude=feature-x,bugfix-y

Important Notes

  • Certain branches (main, master, develop, development, and test) are considered permanent and will not be deleted to prevent accidental removal of important branches.

  • Attempting to delete the main branch will result in an error message, and the script will terminate to protect against accidental deletion.


Feel free to use and modify this script to suit your specific requirements. If you encounter any issues or have suggestions for improvements, please create an issue or submit a pull request on GitHub.

Happy branching and coding! 😄

About

Script to bulk remove git branch locally and remote

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors