GitBranchCleanUp is a command-line tool for managing local Git branches. It allows you to easily delete branches based on your preferences.
GitBranchCleanUp simplifies the process of deleting local Git branches. It provides options to delete all branches except the main branch, delete specific branches by name, or cancel the operation entirely. This tool is especially useful for cleaning up your local repository and removing branches that are no longer needed.
Follow the instructions below to get started with GitBranchCleanUp.
Before using GitBranchCleanUp, ensure that you have the following prerequisites installed on your system:
- Git
- Python 3.x
-
Clone the GitBranchCleanUp repository to your local machine:
git clone https://github.com/dipto0321/GitBranchCleanUp.git
-
Change your working directory to the project folder:
cd GitBranchCleanUp
-
source ~/.bashrc # or source ~/.zshrc if you use Zsh
chmod +x main.py # chmod +x <file_name_as_you_saved>.py'
-
Create an Alias: You can create an alias for the script in your shell configuration file (~/.bashrc, ~/.zshrc, etc.). Edit the appropriate configuration file using a text editor. For example:
vim ~/.bashrc # you can use also other editor of your choice
Add the following line to create an alias:
#alias name can be anything according to your choice # you can only download the main.py file and then rename it as you want alias gbcl='python3 ~/path/to/GitBranchCleanUp/main.py' # alias gbcl='python3 ~/path/to/<file_name_as_you_saved>.py'
Replace
~/path/to/GitBranchCleanUp/main.py
with the actual path to your script. -
Reload the Shell Configuration: After saving the configuration file, you need to either restart your terminal or run the following command to apply the changes immediately:
source ~/.bashrc # or source ~/.zshrc if you use Zsh
To use GitBranchCleanUp, open a terminal and run the following command:
gbm
You will be presented with the following options:
- Delete all local branches except 'main'.
- Delete specific branch/branches.
- Cancel the operation. Follow the prompts to make your selection and manage your Git branches accordingly.
Please follow our code of conduct and contribution guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Thank you to the Git community for inspiration and guidance.