Commit and Push Changes
Commit and push the current changes with strategic git practices.
Context: $ARGUMENTS
Strategy Selection
Strategy A: Squash/Amend (Default)
Use when changes relate to the same feature/theme:
bash
git add -A git commit --amend --no-edit git push --force-with-lease
Strategy B: New Commit
Use for independent changes or when splitting improves clarity:
bash
git add -A git commit -m "type: description" git push
Strategy C: Interactive Rebase
Use to reorganize multiple commits:
bash
git rebase -i origin/main # Squash/reorder as needed git push --force-with-lease
Commit Message Format
code
type: subject (max 50 chars) [optional body - explain "why" not "what"] [optional footer - issue references]
Types: feat, fix, refactor, test, docs, chore, style, perf
Critical Rules
- •NEVER commit directly to main/master branch
- •Remove unnecessary code comments before committing
- •Each commit should be atomic and meaningful
- •Verify changes with
git diff --stagedbefore committing
Process
- •Check current branch (must not be default branch)
- •Review staged changes
- •Select appropriate strategy based on context
- •Create commit with conventional message
- •Push to remote
- •Report success with commit hash