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 🙏

© 2025 – Pkg Stats / Ryan Hefner

commit-hook

v1.4.4

Published

A simple npm package to manage Git hooks with `pre-commit` and `pre-push` hooks. This package helps automate tasks before committing or pushing changes, ensuring that your code adheres to your specified rules.

Downloads

2,981

Readme

Commit Hook

A simple npm package to manage Git hooks with pre-commit and pre-push hooks. This package helps automate tasks before committing or pushing changes, ensuring that your code adheres to your specified rules.

Installation

npm i -g commit-hook

Run this command to initialize git hooks

npx init-git-hook

Usage

Once installed, you can configure the pre-commit and pre-push hooks in your package.json file. These hooks can run scripts or tools you specify before you commit or push your code.

Hooks Available

pre-commit

Runs before you make a commit. This can be used for tasks such as:

  • Code linting
  • Formatting
  • Unit testing

pre-push

Runs before you push your changes to a remote repository. This can be used for tasks like:

  • Running tests
  • Verifying build integrity

Example Workflow

  1. Install the git-hook package.
  2. Add the scripts to the package.json under "scripts".
  3. Once the hooks are configured, they will run automatically when you execute the corresponding Git commands:
    • git commit will trigger the pre-commit hook.
    • git push will trigger the pre-push hook.

Customizing Hooks

You can customize the behavior of the hooks by adjusting the scripts in your package.json. For example, you can use tools like eslint, prettier, or any other commands that fit your project's needs.


Git Aliases

Initialize Git Aliases

Run this command to initialize git aliases:

npx init-git-alias

Resets Git Aliases

If you want to reset your Git aliases, you can run this command:

npx reset-git-alias

This table summarizes the Git aliases you can set up for various Git commands.

| Alias | Command | Description | | ------------------------ | ---------------------------------------------------------- | --------------------------------------------------------- | | git st | status | Show the status of the repository | | git co | checkout | Switch branches or restore working directory files | | git br | branch | List, create, or delete branches | | git cb <name> | !git checkout -b <name> | Create and switch to a new branch | | git cm <message> | commit -m <message> | Commit changes with a message | | git ac <message> | !git add . && git commit -m <message> | Add all changes and commit them with a message | | git acp <msg> <branch> | !git add . && git commit -m "$1" && git push origin "$2" | Add, commit, and push in one step | | git pl | pull | Fetch and integrate with another repository or branch | | git plo | pull origin | Fetch from the remote repository origin | | git ps | push | Update the remote repository with local commits | | git pso | push origin | Push changes to the remote repository origin | | git lg | log --oneline --graph --decorate --all | Show the commit history in a pretty graph format | | git df | diff | Show differences between changes in the working directory | | git rs | reset --soft HEAD~1 | Undo the last commit but keep changes staged | | git rb | rebase | Reapply commits on top of another base commit | | git rm | remote -v | Show remote URLs for the repository | | git cl | !git clean -fd | Remove untracked files and directories | | git stc | diff --cached | Show staged changes | | git hf <file> | log --follow --oneline --graph | Show the commit history of a specific file | | git dbr <branch> | branch -d <branch> | Delete a local branch | | git drbr <branch> | !git push origin --delete <branch> | Delete a remote branch | | git dl | diff HEAD | Show changes since the last commit | | git sta | stash apply | Apply the last stash | | git std | stash drop | Delete the last stash | | git utf | ls-files --others --exclude-standard | Show untracked files | | git rbi | rebase -i | Squash commits interactively | | git prl | log --pretty=format:'%h %s (%an, %ar)' | Show commit information in a readable format |


How to Use the Aliases

After setting up the aliases, use them just like any regular Git command. For example:

  • To check the status of your repository, run:

    git st
  • To commit changes with a message, use:

    git cm "My commit message"
  • To create and switch to a new branch:

    git cb new-branch-name
  • To pull from the remote repository origin:

    git plo
  • To push to the remote repository origin:

    git pso

Contributing

If you would like to contribute to the development of this package, please fork the repository and create a pull request with your changes. Ensure that your code adheres to the existing code style and includes tests if necessary.

License

MIT License