Skip to content

Delete local branches that have been merged (includes "Squash and merge")

Notifications You must be signed in to change notification settings

nekonenene/git-branch-delete-merged-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-branch-delete-merged [Rust Edition]

This CLI app deletes local branches that have been merged also "Squash and merge".

It is based on https://github.com/nekonenene/git-branch-delete-merged written in the Go language, and rewritten in the Rust language.

Installation

Using Homebrew:

macOS or Linux can install through Homebrew.

# Install
brew install nekonenene/tap/git-branch-delete-merged

# Update
brew update && brew upgrade git-branch-delete-merged

# Uninstall
brew remove git-branch-delete-merged

Using binary:

macOS or Linux can do the following.

# Install / Update
curl -fL https://github.com/nekonenene/git-branch-delete-merged-rs/releases/latest/download/git-branch-delete-merged_$(uname -s)_$(uname -m) -o git-branch-delete-merged && chmod +x git-branch-delete-merged
mv git-branch-delete-merged /usr/local/bin

# Uninstall
rm /usr/local/bin/git-branch-delete-merged

Using cargo:

After installing cargo,

# Install
cargo install --git https://github.com/nekonenene/git-branch-delete-merged-rs

# Update
cargo install --force --git https://github.com/nekonenene/git-branch-delete-merged-rs

# Uninstall
cargo uninstall git-branch-delete-merged

Usage

General usage:

If you want to delete a branch that has merged into the main branch:

git-branch-delete-merged main

And if the branch to delete exists, you will get a prompt like this:

Found 2 merged branches: [dev1 dev2]

Are you sure to delete 'dev1' branch? [y|n|l|d|q|help]:

Please type one and press enter.

  • y: Yes, delete the branch
  • n: No, skip deleting
  • l: Show git logs of the branch
  • d: Show the latest commit of the branch and its diff
  • q: Quit immediately
  • h: Show help

Skip prompt:

If you want to delete all merged branches without confirmations, --yes option will be useful.

git-branch-delete-merged main --yes

Thank you

not-an-aardvark/git-delete-squashed is the reference code that helps finding branches which has squashed and merged.

About

Delete local branches that have been merged (includes "Squash and merge")

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages