Files
opencode/command/git-push.md

1.7 KiB
Raw Blame History

description
description
Commit staged files, create version tag, and push to remote repository

Complete workflow: auto-generate commit message, create version tag, commit, and push everything to remote repository.

This is the all-in-one command that combines /git-commit + push operations.

Please perform the following:

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

Refer to /git-commit for detailed steps or @skill/git/SKILL.md for complete workflow.

  1. Push commit to remote:

    git push origin $(git branch --show-current)
    
  2. Push tag to remote (only if tag was created):

    • Polyrepo: git push origin <version>
    • Monorepo: git push origin <subproject>-<version>
  3. Display result in Chinese:

✓ 提交并推送成功

分支:[branch]
提交信息:[commit message]
版本标签:[tag] (如果创建了)

已推送到远程仓库origin
- 提交:[commit hash]
- 标签:[tag]

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

Options:

  • User can input "skip tag" or "skip" to skip tag creation

When to use:

  • /git-commit: Local only, review before pushing
  • /git-push: Commit and push immediately
  • /git-push-tags: Push tags only (no commits)