commit-push
Create a conventional commit and push it to the remote repository. Use when the user wants to commit changes and immediately push them, or says "commit and push" or "push my changes".
When & Why to Use This Skill
This Claude skill automates the end-to-end Git workflow by generating standardized 'Conventional Commits' and pushing them to remote repositories. It enhances developer productivity by handling status checks, staging, message formatting, and branch tracking in a single streamlined process, ensuring a clean and professional project history.
Use Cases
- Streamlining daily development: Rapidly committing and pushing code changes using natural language commands like 'push my changes' without manual git syntax.
- Enforcing commit standards: Automatically formatting commit messages according to the Conventional Commits specification (feat, fix, docs, etc.) to facilitate automated changelog generation.
- Automated branch tracking: Simplifying the process of pushing new local branches to a remote origin by automatically handling the '-u' tracking flag.
- Pre-push verification: Reviewing staged changes and repository status before pushing to ensure only intended code is deployed to the remote repository.
| name | commit-push |
|---|---|
| description | Create a conventional commit and push it to the remote repository. Use when the user wants to commit changes and immediately push them, or says "commit and push" or "push my changes". |
| user-invocable | true |
| - Bash(git | *) |
Git Commit and Push
This skill creates a commit following the Conventional Commits specification and pushes it to the remote repository.
Workflow
Check repository state: Run git status -sb to see:
- Current branch name
- Whether branch tracks a remote
- What files are modified/staged
- How far ahead/behind the remote we are
Review changes: Run git diff or git diff --staged to see what will be committed
Stage files if needed: If no files are staged, ask which files to stage or stage relevant files
Create commit: Follow the same process as the commit skill:
- Analyze changes to determine type (feat, fix, chore, etc.)
- Determine optional scope
- Write clear description in imperative mood
- Add body/footers if needed
- Show proposed message for approval
- Create commit using git commit
Check remote tracking:
- If branch tracks a remote: use git push
- If branch is new/untracked: use git push -u origin
Push to remote: Execute the appropriate push command
Confirm success: Show the result and confirm the push succeeded
Commit Message Format
Follow Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore
See the commit skill for detailed commit message guidelines.
Examples
# Check status
git status -sb
# Review changes
git diff --staged
# Commit with conventional format
git commit -m "feat(tmux): add new key bindings for window management"
# Push to remote
git push
Important Notes
- Always review before pushing: Show the commit message and ask for approval before pushing
- Check remote status: Verify whether branch tracks a remote before pushing
- Handle conflicts: If push is rejected (e.g., remote has changes), inform user and suggest pulling first
- Use -u flag for new branches: When pushing a new branch, use git push -u origin
- Respect git config: Use user's aliases from ~/.gitconfig when appropriate
- No attribution: Do NOT include "Generated with Claude Code" or "Co-Authored-By" lines in commit messages
Error Handling
- Push rejected: If remote has changes, suggest git pull --rebase then push again
- No remote: If repository has no remote, inform user and skip push
- Authentication issues: If push fails due to auth, provide clear error message
- Already up to date: If no changes to push, inform user the remote is already current