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

@beardyman/git-better

v1.6.0

Published

CLI Tool-suite for common git workflow operations including workflows

Downloads

11

Readme

git-better

Unit Tests

A Tool suite of git extensions for day to day use.

Includes configurable workflows that ensure up-to-date branches before creating or finishing working branches.

Included commands are:

git start
git update
git finish
git rename
git promote
git open
git pr

Installation

Works with node 12 or newer.

Also requires git to be installed.

npm i -g @beardyman/git-better

Configuration

git-better has some defaults, however if you have a non-traditional base branch name or want to use some of its more advanced features, you're going to want to create a configuration.

Configurations will be read from two different spots and if they both exist, merged together favoring values in the config closest to the code. A config file can be created in a given repo, or a global config can be created in the user home directory.

You can create a config by hand, however there is a built-in helper to initialize a config from one of the examples in this repository under /example-configs.

git better-init hotfix
# or for a global config
git better-init --global hotfix

This will create a file called .gbrc.json in the root of your repository (or in your home folder if you chose the --global option). If you like, you can convert that file to a .js file and export your config.

Configuration Options

There are only a few base configuration options. These are their defaults:

{
  "defaultBase": "main",
  "defaultRemote": "origin",
  "alwaysPush": false
}

defaultBase is the base branch that any new branch (unless it matches a workflow) will be started from or finished into.

defaultRemote is the remote to push and pull from. This is generally origin however some workflows may specify different remotes for certain purposes. This is overridable with the -r|--remote option.

alwaysPush specifies to push your branches when taking a given action. git finish for example will merge your working branch into its base branch and if this option is true immediately push your merge to the remote. This is overridable with the -p|--push option

Defining Workflows

Workflows can be defined to take specific actions when starting or finishing branches. These are also defined in the .gbrc.json configuration file. An example configuration for a hotfix workflow:

{
  "workflows": {
    "feature": {
      "from": "develop",
      "to": "develop"
    },
    "hotfix": {
      "from": "main",
      "to": [
        "main",
        "develop"
      ]
    }
  },
  "promotionPaths": {
    "develop": "main"
  }
}

This configuration defines two workflows for feature and hotfix branches. This sort of workflow is useful if you need to have multiple base branches for a development environment vs a production environment.

The feature workflow is pretty simple. It will create new branches from the develop branch and also finish branches into the develop branch. To start a new feature branch, use git start feature myBranch, this will create a branch named feature/myBranch from the develop branch using this workflow.

The hotfix workflow works a little differently. It will create new branches from the main branch, but it will merge the branch into main and then develop branch. This allows hotfixes to bypass development environments but still merge any fixes into the develop codebase.

Finally, this configuration also defines a promotion path from develop to main. This means that when git promote is ran on the develop branch, the develop branch will be merged into the main branch effectively promoting the development environment to the production environment in this example.

Usage

Open the repository UI

cd my-git-repo
git open

Open a pull request for your current branch

git pr

Start a new branch

git start feature myBranch

Open the repository UI to the current branch

git open -b|--branch

Update your branch from its base branch

git update

Rename a branch

git rename newBranchName

Finish your branch

git finish

Finish and push your branch

git finish -p|--push

Promote one trunk branch to another

# From the develop branch
git promote

Documentation

Each command has its own man page where all of the options are documented. They can be opened like so:

man git-finish