Giter Club home page Giter Club logo

git-del-br's Introduction

git-del-br

GitHub issues GitHub stars GitHub license PyPI

Deleting Merged Branches

Usage:

        usage: git_del_br.py [-h] [-ls] [-r] [-l] [-a] [-t time] [-br branch]
                 [-pre prefix] [-suf suffix] [-re regex]

        Tool for deleting remote and local merged branches from Git

        optional arguments:
          -h, --help            show this help message and exit
          -ls, --list           Lists the branches (not delete)
          -r, --remote          remove merged branches
          -l, --local           Remove local branches
          -a, --all             Removes both local and remote merged branches
          -t time, --time time  All branches after t-time which the branch is merged
                                (in days) default = -1 means infinite days
          -br branch, --branch branch
                                Branch from which other branches will be analysed
                                (default = current_branch)
          -pre prefix, --prefix prefix
                                Filter branches based on prefix
          -suf suffix, --suffix suffix
                                Filter branches based on suffix
          -re regex, --regex regex
                                Filter branches based on regex

You can find more details about the project here.

Examples

  • For listing remote merged branches which haven't been touched since past 3 months (last commit was 3 months ago)

          git-del-br -ls -r -t=90
    

    For deleting those branches

          git-del-br -r -t=90
    
  • For listing local branches which start with dev prefix

          git-del-br -ls -l -pre='dev'
    

    For deleting those branches

          git-del-br -l -pre='dev'
    
  • You can use regex too. For example: For deleting all branches except release branch:

      git-del-br -l -re='^(?!release).*'
    

INSTALL

You can install this from pip using pip install git-del-br.

CONTRIBUTION

Fork the project. Create a branch from master or gh-pages and submit a PR to the same.

LICENSE

The mighty MIT license. Please check LICENSE for more details.

git-del-br's People

Contributors

koppor avatar tusharmakkar08 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

git-del-br's Issues

Make code cleaner

Use:

  • Subprocess.popen instead of os.system
  • Use array of filters instead of chaining.

Matching by regular expression

Hello! Thank you for great tool!

When I tried to use git-del-br for clean a repo from useless branches I wanted to delete all branches except branches which started from release/<version> or stable/<part_of_app> etc. But I did not find a way for filter by not matching. Could you add opportunity for filter by regular expression? It should be very helpful.

Thanks!

Issue with ls

git-del-br -ls gives help instead of listing both remote and local.

Feature request

Really enjoy this! I do have a feature request, not sure if it is easily implementable.

It would be simply to have a --dry-run option that prints the branch that would be zapped.

I really want to use this at work it seems to work great on my personal projects, but I am afraid of running into a condition or even human mistake that would make me delete a branch that was wanted to keep.

Thanks mate.

Getting fatal: --delete doesn't make sense without any refs

I am executing on git bash on Windows using git version 2.22.0.windows.1. I get following output:

$ git-del-br -a
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs
fatal: --delete doesn't make sense without any refs

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.