npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dlid/gitrid

v1.0.5

Published

Script to delete local git branches if they do not exist in remote repository

Downloads

4

Readme

@dlid/gitrid

Simple tool to delete local git branches that are no longer used


gitrid will "Git rid" of those zombie branches that no longer exists in the remote repository.

  • If a branch has unpushed changes it will not be flagged for deletion
  • If a branch is active it will not be flagged for deletion

Installation

Install it globally for easy access

npm install -g @dlid/gitrid

Usage

gitrid [folder] [--yes|-y] (--verbose | --silent) [--plain-text]

Gitrid will run in your current working folder by default.

To check the current working directory just enter

gitrid

Parameters

| Name | Description
|---|--- |[folder]|a path different from the working folder that you want to check |--yes (-y) | Automatically delete any found zombie branches without asking for confirmation |--version (-v) | Returns the gitrid version number | --silent | Log nothing but errors (must be used toghether with --yes |--verbose|Log in more detail what is done |--plain-text|Will strip away console colors from all output

# Run gitrid in specified folder
gitrid D:/Code

# Run gitrid in specified folder, automatically delete branches if any are found
gitrid D:/Code --yes

# Run gitrid in current folder with verbose logging
gitrid --verbose

Behind the scenes

Gitrid will perform the following actions:

  • git remote get-url origin - Find the URL for the working folder or folder you specify ()
  • git branch List local branches
  • bit branch -r - List remote branches
  • If a local branch does not exist in remote repository:
    • git log --branches --not --remotes --source will be run to see if the branch has any pending commits
  • User will confirm to delete ZOMBIE marked branches, and then for each branch:
    • git branch -d [BRANCH NAME] Delete branch

Change log

  • 1.0.5 - Reworked how remote branches are checked. Previous didn't work very well. Fixed issue where --verbose did not work
  • 1.0.4 - Less output by default. Rearranged some code. Added --verbose, --silent, --plain-text, --help options
  • 1.0.3 - Remote branches are now received once, and not per local branch
  • 1.0.2 - Added check to see if local-only branch has any commits. This will not be flagged for deletion
  • 1.0.1 - Fix where the bin/index.js file was including the wrong file
  • 1.0.0 - First version