101 lines
2.2 KiB
Markdown
101 lines
2.2 KiB
Markdown
---
|
|
description: Commit changes with Conventional Commits format and push to GitHub remote repository.
|
|
---
|
|
|
|
# Update GitHub
|
|
|
|
Commit uncommitted changes and push to remote GitHub repository.
|
|
|
|
## Instructions
|
|
|
|
1. **Check Git Status**
|
|
- Run `git status`
|
|
- Show all uncommitted changes
|
|
|
|
2. **Analyze Changes**
|
|
- Review changed files
|
|
- Determine commit type (feat/fix/docs/refactor/test/chore)
|
|
- Determine scope (affected module/component)
|
|
|
|
3. **Create Commit Message**
|
|
Follow Conventional Commits format:
|
|
```
|
|
<type>(<scope>): <subject>
|
|
|
|
<body>
|
|
|
|
<footer>
|
|
```
|
|
|
|
Types:
|
|
- `feat`: 新功能
|
|
- `fix`: Bug 修复
|
|
- `docs`: 文档更新
|
|
- `refactor`: 代码重构
|
|
- `perf`: 性能优化
|
|
- `test`: 测试相关
|
|
- `chore`: 其他修改
|
|
|
|
4. **Stage and Commit**
|
|
- Run `git add` for affected files
|
|
- Create commit with formatted message
|
|
- Do not include `Co-Authored-By` footers unless the user explicitly asks for them
|
|
|
|
5. **Push to Remote**
|
|
- Run `git push`
|
|
- If rejected, pull with rebase first:
|
|
```bash
|
|
git pull --rebase origin $(git branch --show-current)
|
|
git push
|
|
```
|
|
|
|
6. **Verify Success**
|
|
- Show commit SHA
|
|
- Show remote branch status
|
|
|
|
## Example Usage
|
|
|
|
```
|
|
User: /update-github
|
|
|
|
1. Checking git status...
|
|
Modified: src/utils/helpers.py
|
|
Modified: README.md
|
|
|
|
2. Analyzing changes...
|
|
- src/utils/helpers.py: Refactored helper functions
|
|
- README.md: Updated documentation
|
|
|
|
3. Proposed commit:
|
|
docs(readme): 更新项目文档
|
|
|
|
- 添加使用示例
|
|
- 更新依赖说明
|
|
|
|
4. Proceed? (yes/no/modify)
|
|
|
|
5. Staging files...
|
|
git add src/utils/helpers.py README.md
|
|
|
|
6. Creating commit...
|
|
[main abc1234] docs(readme): 更新项目文档
|
|
|
|
7. Pushing to remote...
|
|
git push
|
|
To github.com:user/repo.git
|
|
abc1234..def5678 main -> main
|
|
|
|
✅ Successfully pushed to GitHub!
|
|
```
|
|
|
|
## Arguments
|
|
|
|
$ARGUMENTS can be:
|
|
- `--amend` - Amend last commit instead of creating new one
|
|
- `--no-verify` - Skip pre-commit hooks
|
|
- `<type>(<scope>): <message>` - Use custom commit message
|
|
|
|
## Integration
|
|
|
|
This command uses the same Conventional Commits format as the `/commit` skill but focuses on the complete flow: stage → commit → push.
|