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

rename-git-tag-cli

v1.0.0

Published

Transactional Git tag rename tool runnable via npx

Readme

rename-git-tag-cli

一个以事务性方式重命名 Git 标签的命令行工具。支持保留原始创建日期、在重命名时编辑标签备注信息、可选跳过 CI,并在任一步骤失败时自动回滚,让仓库状态保持干净。

特性

  • 保留原标签的创建日期(附注/轻量标签均支持)。
  • 可在重命名过程中编辑标签备注信息(使用 $EDITOR 或默认 vim)。
  • 可选择是否跳过 CI(通过 git push -o ci.skip)。
  • 失败自动回滚本地和远程已执行的操作(远程删除旧标签为不可逆关键步骤,会提示人工确认)。

快速开始

  • 使用 npx(推荐):
npx rename-git-tag-cli <旧标签名> <新标签名>
  • 全局安装后执行:
npm i -g rename-git-tag-cli
rename-git-tag <旧标签名> <新标签名>

在 Windows 原生命令行(CMD/PowerShell)环境不支持;请使用 WSL 或在 macOS/Linux 下运行。

使用示例

# 将 v1.0.0 重命名为 v1.0.1
npx rename-git-tag-cli v1.0.0 v1.0.1

运行后会:

  • 检测旧标签类型(附注/轻量)。
  • 读取原始日期与备注(轻量标签会生成默认备注)。
  • 提示是否编辑备注,打开 $EDITOR(未设置则使用 vim)。
  • 创建新标签(保留原始日期)。
  • 询问是否推送到远程并是否跳过 CI。
  • 推送新标签、删除远程旧标签、删除本地旧标签。

交互说明

  • 编辑备注:当提示“是否需要编辑此备注信息?(y/N)”输入 y 将打开编辑器。
  • 推送确认:当提示“是否要将更改推送到远程仓库 'origin'?(y/N)”输入 y 确认。
  • 跳过 CI:当提示“是否需要跳过本次 Tag 推送触发的 CI/CD 流水线?(y/N)”输入 y 将附加 -o ci.skip

平台支持

  • 支持:macOS、Linux、WSL(需安装 bashgit)。
  • 不支持:Windows 原生命令行(CMD/PowerShell)。

运行要求

  • Git 仓库环境:必须在一个有效的 Git 仓库目录下运行。
  • 依赖:bashgitvim(如未设置 $EDITOR 时)。
  • 远程名:默认使用 origin

本地开发

  • 使用 Node 入口在本地直接调用:
node bin/rename-git-tag.js <旧标签名> <新标签名>
  • 或使用 npm 包测试:
npm pack              # 生成 .tgz 包
npm i -g ./<生成的>.tgz
rename-git-tag <旧> <新>

发布到 npm

  • 登录并发布(公开包):
npm login
npm publish --access public
  • 版本管理:
npm version patch     # 或 minor/major
npm publish

包名当前为 rename-git-tag-cli,如需改为其他名称,可在 package.json 中修改 name

常见问题

  • Windows 不支持?
    • 请在 WSL(Windows Subsystem for Linux)中运行,或在 macOS/Linux 环境下使用。
  • 编辑器未打开?
    • 设置环境变量 EDITOR,例如:export EDITOR=nano,否则默认使用 vim
  • CI 跳过不起作用?
    • 需远端 Git 服务支持 -o ci.skip push 选项(例如部分 GitLab/GitHub 设置)。
  • 回滚说明:
    • 如果远程旧标签已删除,这是不可逆关键步骤,脚本会提示人工检查远程状态。

许可证

MIT