Git Backup Skill
Overview
Provides three local Git backup strategies to help users safely manage file changes.
Backup Strategies (Ask user to choose)
Strategy 1: Auto-commit every change
- Use case: Important config files, sensitive data
- Workflow:
- Detect file changes
- Automatically stage changed files
- Generate commit message following Conventional Commits
- Create local commit
Strategy 2: Never create commits
- Use case: Temporary files, test files, large binaries
- Workflow:
- Detect file changes
- Display change status only, no Git operations
- User manages these files manually
Strategy 3: Ask user to create commit
- Use case: Daily development work
- Workflow:
- Detect file changes
- Display change summary
- Ask user if they want to commit
- Execute based on user choice
Commit Message Convention (Conventional Commits)
Format
<type>(<scope>): <description>
[optional body]
[optional footer]
Type Definitions
feat: New featurefix: Bug fixdocs: Documentation updatestyle: Code formattingrefactor: Code refactoringtest: Test relatedchore: Build/tool changes
Examples
feat(config): add backup schedule configuration
fix(auth): resolve login timeout issue
docs(readme): update installation steps
Error Handling
Common Issues
- Git repo not exists → Prompt user to initialize repo
- File conflicts → Show conflicted files, suggest resolution
- Commit message too long → Auto-truncate or prompt user
Rollback Mechanism
- Keep last 10 commit records
- Support
git resetto specific version
Usage Examples
Example 1: Config File Backup
# Strategy 1: Auto-commit
Detecting config.json change
Staging file...
Creating commit: feat(config): update backup settings
Example 2: Temporary File Handling
# Strategy 2: No commit
Detecting temp.log change
File not in version control (user chose not to commit)
Example 3: Interactive Confirmation
# Strategy 3: Ask user
Detecting src/main.py change
Change summary:
- Modified 3 functions
- Added 2 new methods
Create commit? (y/n)