Petbot/README_git_script.md
megaproxy 124336e65f Update documentation - 2025-07-14 16:41
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-14 16:41:48 +01:00

73 lines
No EOL
1.8 KiB
Markdown

# Smart Git Push Script 🚀
Token-efficient git workflow for development.
## Usage
### Auto-commit (recommended for small changes):
```bash
./git_push.sh
```
### Custom commit message:
```bash
./git_push.sh "Fix critical bug in player profiles"
```
## Features
- **Auto-detection**: Recognizes file types and generates appropriate commit messages
- **Smart categorization**: Groups changes by type (Python code, web interface, database, etc.)
- **Error handling**: Stops on git errors, graceful handling of edge cases
- **Minimal output**: Just shows success/failure, saves tokens
- **Safety checks**: Verifies git repo, checks for changes before committing
## Auto-Generated Messages
Examples of what the script generates:
- `Update Python code - 2024-01-15 14:30`
- `Update web interface, bot modules - 2024-01-15 14:31`
- `Update database, configuration - 2024-01-15 14:32`
## Token Savings
- **Before**: ~200-300 tokens per git operation
- **After**: ~20-50 tokens per git operation
- **Savings**: ~75% reduction in git-related token usage
## Claude Usage - TOKEN EFFICIENT WORKFLOW
**✅ CORRECT (Low Token Usage):**
```
Please run: ./git_push.sh
```
*Claude ignores output completely*
**❌ AVOID (High Token Usage):**
```
git status
git add .
git commit -m "..."
git push origin main
```
*Reading outputs wastes tokens*
## Logging System
- All operations logged to `git_push.log`
- Only check log if there's an issue
- **Claude should NOT read logs unless asked**
- Log file ignored by git
## Error Handling
If push fails:
1. User will see error on console
2. User can ask: "Check the git log for errors"
3. Only then should Claude read `git_push.log`
## Token Savings Protocol
- **Normal operation**: Use script, ignore output
- **Only on errors**: Read logs when requested
- **Maximum efficiency**: No unnecessary output reading