docs: 重构命令和技能文档体系,规范化文档格式和内容组织
This commit is contained in:
@@ -2,189 +2,54 @@
|
||||
description: Commit staged files, create version tag, and push to remote repository
|
||||
---
|
||||
|
||||
# git-push
|
||||
Complete workflow: auto-generate commit message, create version tag, commit, and push everything to remote repository.
|
||||
|
||||
Complete workflow: auto-generate commit message, create version tag, and push everything to remote repository.
|
||||
This is the **all-in-one command** that combines `/git-commit` + push operations.
|
||||
|
||||
## What It Does
|
||||
Please perform the following:
|
||||
|
||||
This is the **all-in-one command** that:
|
||||
1. ✓ Analyzes and commits staged changes (like `/git-commit`)
|
||||
2. ✓ Creates version tag if needed
|
||||
3. ✓ Pushes commit to remote repository
|
||||
4. ✓ Pushes tag to remote repository
|
||||
1-7. **Follow the same steps as `/git-commit`:**
|
||||
- Check staging area (must not be empty)
|
||||
- Analyze changes and repository type
|
||||
- Detect project type and version
|
||||
- Generate commit message (Conventional Commits, Chinese)
|
||||
- Update version number if needed
|
||||
- Commit changes
|
||||
- Create version tag
|
||||
|
||||
## Quick Start
|
||||
Refer to `/git-commit` for detailed steps or `@skill/git/SKILL.md` for complete workflow.
|
||||
|
||||
Use this command when you want to commit AND push in one step.
|
||||
8. **Push commit to remote:**
|
||||
```bash
|
||||
git push origin $(git branch --show-current)
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
9. **Push tag to remote** (only if tag was created):
|
||||
- Polyrepo: `git push origin <version>`
|
||||
- Monorepo: `git push origin <subproject>-<version>`
|
||||
|
||||
**Staging area must have files:**
|
||||
```bash
|
||||
git add <files>
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
User can optionally input:
|
||||
- **"skip tag"** or **"skip"**: Skip tag creation, only commit and push
|
||||
|
||||
## Workflow
|
||||
|
||||
This command combines `/git-commit` + push operations:
|
||||
|
||||
1. ✓ Check staging area
|
||||
2. ✓ Analyze changes and repository type
|
||||
3. ✓ Detect project type and version
|
||||
4. ✓ Generate commit message
|
||||
5. ✓ Update version number if needed
|
||||
6. ✓ Commit with generated message
|
||||
7. ✓ Create version tag
|
||||
8. ✓ Push commit to remote
|
||||
9. ✓ Push tag to remote
|
||||
|
||||
## Steps
|
||||
|
||||
### 1-8. Commit and Tag
|
||||
|
||||
Execute the same steps as `/git-commit`:
|
||||
- Check staging area (must not be empty)
|
||||
- Collect information (status, diff, logs, tags, AGENTS.md)
|
||||
- Detect repository type (polyrepo/monorepo)
|
||||
- Detect project type and version file
|
||||
- Generate commit message (Conventional Commits, Chinese/English)
|
||||
- Update version number if needed
|
||||
- Commit changes
|
||||
- Create tag if needed
|
||||
|
||||
Refer to `/git-commit` for detailed steps or see `skill/git/SKILL.md`.
|
||||
|
||||
### 9. Push Commit to Remote
|
||||
|
||||
```bash
|
||||
# Push current branch to origin
|
||||
git push origin $(git branch --show-current)
|
||||
```
|
||||
|
||||
### 10. Push Tag to Remote
|
||||
|
||||
**Only if tag was created:**
|
||||
|
||||
**Polyrepo:**
|
||||
```bash
|
||||
git push origin <version>
|
||||
# Example: git push origin 1.2.0
|
||||
```
|
||||
|
||||
**Monorepo:**
|
||||
```bash
|
||||
git push origin <subproject>-<version>
|
||||
# Example: git push origin ios-1.2.0
|
||||
```
|
||||
|
||||
### 11. Display Result
|
||||
|
||||
Show summary in Chinese:
|
||||
10. **Display result in Chinese:**
|
||||
```
|
||||
✓ 提交并推送成功
|
||||
|
||||
分支:main
|
||||
提交信息:feat(android): 添加用户认证
|
||||
版本标签:android-1.3.0
|
||||
分支:[branch]
|
||||
提交信息:[commit message]
|
||||
版本标签:[tag] (如果创建了)
|
||||
|
||||
已推送到远程仓库:origin
|
||||
- 提交:a1b2c3d
|
||||
- 标签:android-1.3.0
|
||||
- 提交:[commit hash]
|
||||
- 标签:[tag]
|
||||
```
|
||||
|
||||
## Comparison with Other Commands
|
||||
**Error handling:**
|
||||
- If staging area is empty: "暂存区为空,请先使用 `git add` 添加文件。"
|
||||
- If push fails (e.g., need to pull first): Show error in Chinese with suggested solutions
|
||||
- If remote rejects tag (already exists): Show error and suggest deleting local tag or updating version
|
||||
|
||||
| Command | Commit | Tag | Push Commit | Push Tag |
|
||||
|---------|--------|-----|-------------|----------|
|
||||
| `/git-commit` | ✓ | ✓ | ✗ | ✗ |
|
||||
| `/git-push` | ✓ | ✓ | ✓ | ✓ |
|
||||
| `/git-push-tags` | ✗ | ✗ | ✗ | ✓ (all tags) |
|
||||
**Options:**
|
||||
- User can input "skip tag" or "skip" to skip tag creation
|
||||
|
||||
## Use Cases
|
||||
|
||||
- **Quick workflow**: Commit and push in one command
|
||||
- **Release preparation**: Create version tag and push for CI/CD
|
||||
- **Daily development**: Commit and sync with remote immediately
|
||||
|
||||
## When to Use Which Command
|
||||
|
||||
**Use `/git-commit`** (local only):
|
||||
- You want to review before pushing
|
||||
- Working on feature branch not ready to share
|
||||
- Creating multiple commits before one push
|
||||
|
||||
**Use `/git-push`** (commit + push):
|
||||
- Ready to share changes immediately
|
||||
- Main branch development with CI/CD
|
||||
- Quick fixes that should be synced now
|
||||
|
||||
**Use `/git-push-tags`** (tags only):
|
||||
- Already committed but forgot to push tags
|
||||
- Want to push multiple accumulated tags at once
|
||||
- Tag-only sync without new commits
|
||||
|
||||
## Error Handling
|
||||
|
||||
### If Staging Area is Empty
|
||||
|
||||
```
|
||||
暂存区为空,请先使用 `git add` 添加文件。
|
||||
```
|
||||
**Action:** Terminate, user must stage files first.
|
||||
|
||||
### If Push Fails
|
||||
|
||||
Common reasons:
|
||||
- Remote branch protection
|
||||
- Need to pull first (diverged history)
|
||||
- No permission to push
|
||||
|
||||
**Action:** Display error in Chinese, suggest solutions:
|
||||
```
|
||||
✗ 推送失败
|
||||
|
||||
原因:远程分支有更新,需要先拉取
|
||||
|
||||
建议操作:
|
||||
1. git pull --rebase origin main
|
||||
2. 解决冲突(如有)
|
||||
3. 重新运行 /git-push
|
||||
```
|
||||
|
||||
### If Remote Rejects Tag
|
||||
|
||||
If tag already exists on remote:
|
||||
```
|
||||
✗ 标签推送失败
|
||||
|
||||
原因:远程仓库已存在标签 1.2.0
|
||||
|
||||
建议操作:
|
||||
1. 删除本地标签:git tag -d 1.2.0
|
||||
2. 更新版本号后重新提交
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- **Main branch**: Default push target is `main` (not `master`)
|
||||
- **Conventional Commits**: Auto-generated messages follow standard format
|
||||
- **Semantic Versioning**: Automatic version bumping based on change type
|
||||
- **Polyrepo/Monorepo**: Automatically detects and uses correct tag format
|
||||
- **Platform-specific**: Commit messages in Chinese (macOS/Linux) or English (Windows)
|
||||
|
||||
## Related Commands
|
||||
|
||||
- `/git-status` - Check changes before committing
|
||||
- `/git-commit` - Commit locally without pushing
|
||||
- `/git-push-tags` - Push only tags (no commits)
|
||||
|
||||
## Reference
|
||||
|
||||
Complete git workflow guide: `skill/git/SKILL.md`
|
||||
Quick command reference: `skill/git/quick-reference.md`
|
||||
**When to use:**
|
||||
- `/git-commit`: Local only, review before pushing
|
||||
- `/git-push`: Commit and push immediately
|
||||
- `/git-push-tags`: Push tags only (no commits)
|
||||
|
||||
Reference in New Issue
Block a user