Commit and Push
When the user wants to commit and push changes (detected via /commit-push command or phrases like "commit and push", "save my changes", "push this", "commit this"), follow this workflow:
1. Gather Context
Run these commands in parallel:
git status
git diff --staged
git diff
git log --oneline -5
2. Stage Changes
If there are unstaged changes the user likely wants committed:
git add -A
If unsure which files to include, ask the user.
3. Write Commit Message
Use gitmoji style with this format:
<emoji> <type>: <short description>
<optional body explaining what and why>
Gitmoji Reference
| Emoji | Code | Use for |
|-------|------|---------|
| β¨ | :sparkles: | New feature |
| π | :bug: | Bug fix |
| π§ | :wrench: | Configuration |
| π | :memo: | Documentation |
| β»οΈ | :recycle: | Refactor |
| π¨ | :art: | Style/format |
| β‘ | :zap: | Performance |
| π | :lock: | Security |
| π§ͺ | :test_tube: | Tests |
| π | :rocket: | Deploy |
| ποΈ | :wastebasket: | Remove code/files |
| π¦ | :package: | Dependencies |
| ποΈ | :building_construction: | Architecture |
| π | :lipstick: | UI/cosmetic |
Examples
β¨ feat: add user authentication flow
Implements JWT-based auth with refresh tokens.
Adds login, logout, and session management.
π fix: resolve race condition in data fetching
The useEffect cleanup wasn't cancelling pending requests,
causing state updates on unmounted components.
π§ config: update ESLint rules for stricter typing
4. Commit and Push
git commit -m "<message>"
git push
If push fails due to remote changes:
git pull --rebase
git push
5. Report Result
After successful push, show:
- Commit hash (short)
- Branch name
- Files changed summary
- Remote URL for easy access
Important
- Never use
--forceunless explicitly requested - Never skip hooks (
--no-verify) unless explicitly requested - If there are merge conflicts, stop and explain the situation
- Keep commit messages concise but informative