Giter VIP home page Giter VIP logo

git-cleanup's Introduction

git-cleanup

A simple interactive command line tool to help you cleanup your git branch detritus.

This is what git-cleanup does:

  1. Iterates over all remote branches (assumes origin), starting with the newest. For each branch:
  2. If the branch has been merged into master it offers to delete it, first remotely then locally.
  3. If the branch has not been merged it shows you all the un-merged commits, and offers to show you a diff (in your GIT_EDITOR). This makes it easy to determine whether the branch should be removed or not.
    Once you have viewed the diff you will be asked whether you wish to delete the branch as before.

Every destructive operation is interactive - nothing unexpected will happen to your repo. It's perfectly fine to Ctrl-C at any time if you get bored of deleting branches and want to do some real work.

Usage

Install the gem

$ gem install git-cleanup

Inside a git repo, just run git-cleanup

$ git-cleanup

Use --skip-unmerged to ignore un-merged branches

$ git-cleanup --skip-unmerged

Use --only to only consider branch names that have this substring

$ git-cleanup --only myname

Be careful, if you delete a critical branch it's not my fault. Piping in yes is a bad idea.

Hacking

There are no tests, this was a quick hack to get the job done.

Pragmatic patches welcome, please open an issue first to discuss.

git-cleanup's People

Contributors

chrisricca avatar mloughran avatar vivienschilis avatar

Watchers

 avatar  avatar

Forkers

dwoos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.