Skip to content

Commit 641be7b

Browse files
xlorneclaude
andcommitted
chore: improve git-push command with detailed steps
Add comprehensive execution steps, safety precautions, and output requirements for git push operations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e045eb1 commit 641be7b

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

.claude/commands/git-push.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
---
2+
name: git push command
3+
4+
---
5+
16
# git push command
27

3-
根据当前调整内容,并创建git的提交指令,并添加对应的提交信息,然后执行git push命令将本地的提交推送到远程仓库。
8+
根据当前代码调整内容,完成以下步骤:
9+
10+
## 执行步骤
11+
12+
1. **检查变更状态**:运行 `git status` 查看所有未跟踪和已修改的文件
13+
2. **查看变更详情**:运行 `git diff` 查看已暂存和未暂存的变更内容
14+
3. **查看最近提交**:运行 `git log` 查看最近的提交信息风格
15+
4. **分析变更内容**:总结变更的性质(新功能/修复/重构/测试/文档等)
16+
5. **添加文件**:使用 `git add` 添加相关文件(避免使用 -A 或 . 一次性添加所有文件,注意排除敏感文件如 .env、credentials 等)
17+
6. **创建提交**:创建新提交,提交信息遵循项目风格,格式为:
18+
- 标题:简短描述(不超过 50 字符)
19+
- 正文:详细说明(如果需要)
20+
- 尾部:添加 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21+
7. **验证提交**:运行 `git status` 确认提交成功
22+
8. **推送到远程**:运行 `git push` 将本地提交推送到远程仓库
23+
24+
## 注意事项
25+
26+
- 永远不要使用 `git add -A``git add .`,应指定具体文件名
27+
- 永远不要使用破坏性命令如 `git push --force``git reset --hard``git checkout .``git restore .``git clean -f`
28+
- 永远不要跳过 hooks(--no-verify)或跳过签名(--no-gpg-sign)
29+
- 如果 pre-commit hook 失败,修复问题后创建新的提交(不要 amend)
30+
- 永远不要直接推送到 main/master 分支
31+
- 如果需要推送,创建新分支后推送
32+
33+
## 输出要求
34+
35+
完成后返回 PR URL(如果有创建 PR)

0 commit comments

Comments
 (0)