The script is helpfull when you want to delete batch of branches. It finds all remote/local branches by the author email and ask you for deletion.
On Linux
-
Clone the repo. to your home folder.
-
Change the default settings:
# defaults
REPOSITORY="local"
AUTHOR="[email protected]"
PROJECT_FOLDER="current"-
Add following code to your ~/.bash_aliases.
alias git-clean='sh ~/git-branch-cleaner/git-branch-cleaner.sh'The name of alias is up to you. -
Reload aliases in CLI.
source ~/.bash_aliases -
Now when you go to project folder, the git-clean command execute git-branch-cleaner.
-
You can run it with some parameters overwriting default settings. Overview of options also is under git-clean man cmd:
- -a - Author of the repositories. (email)
- -r - You can set local or remote GIT repositories.
- -pf - Define path to git repository. Usually root of your project. When passed value is current, the branch cleaner is looking for .git folder in current dir.