All Projects → agateau → git-bonsai

agateau / git-bonsai

Licence: GPL-3.0 License
Tend the branches of your git garden

Programming Languages

rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to git-bonsai

white-theme-vscode
Minimalist monochrome theme for Visual Studio Code
Stars: ✭ 66 (+340%)
Mutual labels:  clean
no-more-masters
Rename your default Git branch from master to production
Stars: ✭ 27 (+80%)
Mutual labels:  branches
CleanUI
Android library to create beautiful, clean and minimal UIs.
Stars: ✭ 19 (+26.67%)
Mutual labels:  clean
dobbi
An open-source NLP library: fast text cleaning and preprocessing
Stars: ✭ 21 (+40%)
Mutual labels:  clean
gitnim
choosenim for choosey nimions
Stars: ✭ 18 (+20%)
Mutual labels:  branches
CleanSwiftArchitectureGenerator
🔨 A generator of Clean Swift Architecture files
Stars: ✭ 56 (+273.33%)
Mutual labels:  clean
branch-switcher
a GitHub bot that switches the base branch of pull requests to the preferred branch
Stars: ✭ 15 (+0%)
Mutual labels:  branches
Modesta
🎨 A clean CSS framework made to be dark, responsive and easy to build with.
Stars: ✭ 76 (+406.67%)
Mutual labels:  clean
clean-code-php
Persian translation of clean code concepts in PHP | ترجمه فارسی مفاهیم کد تمیز در پی اچ پی
Stars: ✭ 38 (+153.33%)
Mutual labels:  clean
minimum-viable-startpage
A very simple startpage to replace new tab in a browser of choice.
Stars: ✭ 61 (+306.67%)
Mutual labels:  clean
harbor-cleaner
Clean images in Harbor by policies
Stars: ✭ 29 (+93.33%)
Mutual labels:  clean
branch-names
Github action to retrieve branch or tag names with support for all events.
Stars: ✭ 99 (+560%)
Mutual labels:  branches
nodejs-clean
Clean Architecture with Node.js + Express.js
Stars: ✭ 136 (+806.67%)
Mutual labels:  clean
remove-files-webpack-plugin
A plugin for webpack that removes files and folders before and after compilation.
Stars: ✭ 48 (+220%)
Mutual labels:  clean
hast-util-sanitize
utility to sanitize hast nodes
Stars: ✭ 34 (+126.67%)
Mutual labels:  clean
Alphalio
A clean HTML5 Resume/CV template
Stars: ✭ 23 (+53.33%)
Mutual labels:  clean
hyper-clean
✨ A clean Hyper theme with IBM Design colors
Stars: ✭ 30 (+100%)
Mutual labels:  clean
Eyepetizer
An unofficial Eyepetizer(开眼视频) App built using Ijkplayer, RxJava2, Retrofit2, Dagger2, Room , DataBinding and Clean-MVVM Architecture.
Stars: ✭ 22 (+46.67%)
Mutual labels:  clean
mold
✂️ Is a general library to help modify or set data within data structures and other objects.
Stars: ✭ 114 (+660%)
Mutual labels:  clean
CSGO
A CSGO "base" with aimbot, BSP parsing, bunnyhop, triggerbot, aimassist, no flash and walkbot, glow esp
Stars: ✭ 80 (+433.33%)
Mutual labels:  clean

Git Bonsai

Git Bonsai is a command-line tool to help you tend the branches of your git garden.

Usage

Just run git bonsai in a git repository checkout.

What does it do?

Git Bonsai does the following:

  1. Fetches remote changes.

  2. Iterates on all your local tracking branches and update them to their remote counterparts.

  3. Lists branches which can be safely deleted and lets you select the ones to delete.

Is it safe?

Git Bonsai takes several precautions to ensure it does not delete anything precious:

  1. It refuses to run if there are any uncommitted changes. This includes unknown files.

  2. It always prompt you before deleting any branch, and explains why this branch is safe to remove.

  3. It refuses to delete a branch if it is not contained in another branch.

  4. Git Bonsai never touches the remote repository.

Demo

Here is an example repository:

$ git log --oneline --all --graph

* b87566d (duplicate2, duplicate1) Create duplicate1
*   e02d47e (HEAD -> master) Merging topic1
|\
| *   020b54c (topic1) Merging topic1-1
| |\
| | * cd060dc (topic1-1) Create topic1-1
| |/
| * f356524 Create topic1
|/
| * 85a9880 (topic2) Create topic2
|/
* 0f209d0 Init

(You can create this repository with the create-demo-repository script)

topic1 and topic1-1 branches can be safely deleted. topic2 cannot. One of duplicate1 and duplicate2 can also be deleted, but not both.

Let's run Git Bonsai:

$ git bonsai
Info: Fetching changes
These branches point to the same commit, but no other branch contains this
commit, so you can delete all of them but one.

Select branches to delete:
> [x] duplicate1
  [x] duplicate2

I press Space to uncheck duplicate1, then Enter to continue.

Info: Deleting duplicate2
Select branches to delete:
> [x] topic1, contained in:
      - master
      - duplicate1

  [x] topic1-1, contained in:
      - topic1
      - duplicate1
      - master

Looks good to me, so I press Enter.

Info: Deleting topic1
Info: Deleting topic1-1

Let's look at the repository now:

$ git log --oneline --all --graph

* 0dfd179 (duplicate1) Create duplicate1
*   5d06a2d (HEAD -> master) Merging topic1
|\
| *   6a3b1de Merging topic1-1
| |\
| | * 7671947 Create topic1-1
| |/
| * c328fee Create topic1
|/
| * 1616d9e (topic2) Create topic2
|/
* 71913d9 Init

Installation

Stable version

The easiest way to install is to download an archive from the release page, unpack it and copy the git-bonsai binary in a directory in $PATH.

Git snapshots

Snapshots from the master branch are available from builds.agateau.com/git-bonsai.

Building it

Git Bonsai is written in Rust. To build it, install Rust and then run:

cargo install git-bonsai

Debugging

If you define the GB_DEBUG environment variable, Git Bonsai will print all the git commands it runs.

Why yet another git cleaning tool?

I created Git Bonsai because I wanted a tool like this but also as a way to learn Rust. There definitely are similar tools, probably more capable, and the Rust code probably needs work, pull requests are welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].