gcyb
is a CLI tool for Git designed to detect and, optionally, delete branches that have already been merged into your current branch/HEAD. This tool ensures that remote branches are not deleted or updated without your explicit permission. The commands for reading and deleting branches are separated to avoid unintentional cleaning of important branches.
- Listing Merged Branches: Lists all the branches that have already been merged into the current branch in a table format.
- Deletable Branches: Identifies branches eligible for deletion based on being already merged into your branch. Stale branches, which have not received commits for an extended period, are highlighted but left for user analysis.
- Interactive Deletion: Allows you to interactively choose which branches you want to delete.
- Safety First: Prioritizes safety by not automatically deleting or updating remote branches.
gcyb
The default execution of the CLI. It will render a table with each branch that could be deleted, and the reason of it. It does not clean or delete.
gcyb
gcyb clean
Deletes every branch that is considered 'deletable'. To be eligible for deletion, a branch must be already merged into your current branch. This command will ask for permission, twice.
gcyb clean
gcyb pick
Interactively select which branches you want to delete.
gcyb pick
gcyb help
Displays information on each command or flag of gcyb.
# Any of these counts as valid.
gcyb help | gcyb -h | gcyb --help
repoPath
Can specify the path of a local git repository, instead of using the working directory (current dir).
# Any of these counts as valid.
gcyb -r path/to/repo | gcyb --repo path/to/repo
It is common to have branches where we merge our changes depending on the environment. For that reason, gcyb
will not recognize or try to clean the following branches:
- main
- master
- development
- dev
- testing
- test
More items could be added to the list in the future.
Ensure you have Go installed on your system.
git clone https://github.com/lucaspiritogit/gcyb.git
cd gcyb
go build
go install
gcyb | ./gcyb | ./gcyb.exe
Downloading an .exe could and should be approached with caution, especially due to the potential risks associated with malware and viruses. While I provide the .exe in each Release for the convenience of users who do not wish to install Golang on their systems, its important to verify the integrity of the downloaded binary. I always recommend to build from source when its possible.
Note: Windows is popular for giving false positives on virus detection. If you encounter any problem, please let me know.
To verify the integrity of the gcyb.exe binary on Windows, you can use the Get-FileHash command. Open a PowerShell window and run the following command:
Get-FileHash gcyb.exe
On Linux, you can use the sha256sum command to verify the checksum of the gcyb binary. Open a terminal and run the following command:
sha256sum gcyb
Compare the output checksum with the one provided in the Releases page of this project.
Feel free to open issue or PR's. Feedback and contributions are welcome.