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 🙏

© 2026 – Pkg Stats / Ryan Hefner

append-branch-commit

v1.0.9

Published

自动将 git 当前分支名追加到 commit 提交信息末尾的 husky 钩子工具

Readme

append-branch-commit

自动将 git 当前分支名追加到 commit 提交信息末尾。

效果

fix: 修复登录问题fix: 修复登录问题 (feature/login)

在其他项目中使用(推荐)

目标项目根目录执行:

# 1. 初始化 husky(仅首次)
npx husky init

# 2. 从 npm 拉取本工具并写入 .husky(仅首次,或升级脚本时重跑)
npx append-branch-commit@latest

也可不写 @latest,建议升级时显式使用 @latest 避免 npx 缓存旧版本。

执行后会自动:

  1. 复制脚本 → .husky/append-branch-to-commit.mjs
  2. .husky/commit-msg 追加:
# 运行分支名添加脚本
node .husky/append-branch-to-commit.mjs "$1"

目标项目无需 npm install append-branch-commit,也不会package.json 里增加依赖;配置完成后只靠 .husky 里的文件工作。


验证

git commit -m "test"
# 应变为:test (当前分支名)

升级脚本

工具发新版本后,在目标项目重新执行:

npx append-branch-commit@latest

会覆盖 .husky/append-branch-to-commit.mjscommit-msg 已配置则不会重复追加。


安装后的目录结构

.husky/
├── append-branch-to-commit.mjs
├── commit-msg
└── _/husky.sh

维护者:发布到 npm

1. 登录 npm(仅首次)

npm login

2. 检查包名与版本

npm view append-branch-commit version

修改 package.json 中的 version(须大于线上版本),并更新 repository / homepage 为真实 Git 地址。

3. 发布

npm publish

公开发布默认 access: public。若使用 scope 包:npm publish --access public

4. 验证

npx append-branch-commit@latest

环境

  • Node.js >= 14
  • Windows / macOS / Linux
  • husky v6+