Save and Push to GitHub
Automatically save all your changes and push them to GitHub with a single command.
How It Works
- Check current repository status and changes
- Analyze the changes to generate an appropriate commit message
- Add all changes to staging
- Create commit with generated (or provided) message
- Push to remote repository
Workflow Steps
When /save is invoked:
Check Status: Run git status to see all untracked and modified files
Analyze Changes: Run git diff to understand what changed
Review Commit History: Run git log -5 --oneline to understand the project's commit message style
Generate Commit Message: Based on the diff analysis, create a concise commit message that:
- Summarizes the nature of changes (feature, fix, refactor, docs, etc.)
- Is concise (1-2 sentences)
- Follows the project's commit style
- If user provided an argument, use that as the commit message instead
Stage All Changes: Run git add . to stage all changes
Create Commit: Run `git commit -m "$(cat <<'EOF'
[Generated or provided message]
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com
EOF
)"`
Push to Remote: Run git push to push changes to remote repository
Confirm Success: Run git status to verify everything was pushed successfully
Usage
/save
Or with a custom commit message:
/save "Add new feature for user authentication"
Important Notes
- All unstaged and untracked files will be added automatically
- A commit message will be generated based on the changes unless one is provided
- Changes will be pushed to the current branch
- If push fails (e.g., need to pull first), inform user and suggest next steps
- Never skip the Co-Authored-By tag
Error Handling
If any step fails:
- Inform the user clearly what went wrong
- Suggest corrective actions
- Don't proceed to next steps if a critical step fails