npm-engine-tools-oh
v1.0.13
Published
npm智能质量治理引擎
Readme
Git 自动提交推送工具
在其他项目测试的 3 种方式
方式 1:直接复制脚本(最快)
# 1. 进入你要测试的项目
cd /path/to/your-project
# 2. 复制脚本
mkdir -p scripts
cp /path/to/build/scripts/git-commit.js scripts/
cp /path/to/build/scripts/create-tag.js scripts/
# 3. 运行测试
node scripts/git-commit.js "测试提交信息"方式 2:npm link 全局链接(推荐)
# 1. 在工具目录执行
npm link
# 2. 在任意项目使用
git-push "提交信息"
git-tag patch方式 3:npx 直接运行(无需安装)
# 发布到 npm 后,任意项目可直接运行
npx git-auto-push "提交信息"命令说明
| 命令 | 说明 | 示例 |
|------|------|------|
| git-push "msg" | 提交并推送 | git-push "feat: 新功能" |
| git-tag patch | 补丁版本 | 1.0.0 → 1.0.1 |
| git-tag minor | 次要版本 | 1.0.0 → 1.1.0 |
| git-tag major | 主要版本 | 1.0.0 → 2.0.0 |
测试步骤
找一个已有的 Git 项目
cd D:\\some-other-project确保有远程仓库
git remote -v # 如果没有,添加一个测试仓库 git remote add origin https://github.com/your/test-repo.git修改任意文件
echo "test" >> README.md运行脚本提交
# 方式1: 复制脚本后 node scripts/git-commit.js "test: 测试提交" # 方式2: npm link 后 git-push "test: 测试提交"验证推送结果
git log --oneline -3- 验证推送结果
git log --oneline -3
手动 Git 命令对照
# 查看远程地址
git remote get-url origin
# 查看当前分支
git branch --show-current
# 完整提交流程
git add .
git commit -m "提交信息"
git push origin main
# 创建标签流程
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0