Home

Awesome

git-branchcut

go Software License version

git-branchcut is a git add-on for cleaning up git outdated branches with various options.

Why?

I created this because there are too many branches stacked in my macbook. But there is no easy way to cleanup many outdated branches at once. Instead of deleting branches manually, this can be a solution.

Install

Homebrew

You can install git-branchcut via homebrew.

brew tap dlsrb6342/git-branchcut https://github.com/dlsrb6342/git-branchcut
brew install dlsrb6342/git-branchcut

Download

Alternately, you can download executable file for your platform from github release.

Usage

git branchcut help
git branchcut version
git branchcut execute [opts]
Cut branches

Usage:
  branchcut execute [flags]

Flags:
  -o, --day-offset int       Day offset. Branches that is committed before day offset would be deleted
      --dry-run              Only print branch list that would be delete, without deleting it.
      --force                Allow deleting the branch irrespective of its merged status.
  -h, --help                 help for execute
  -m, --main-branch string   Default branch name (default "main")
  -p, --pattern string       Pattern for branch name

Global Flags:
  -g, --executable-git-path string   The git executable to use (default "git")

You can cleanup branches with day-offset or pattern. If you set both two options, only branches that meet both conditions will be deleted.