# Git Backup

> Backup files with Git Repository. Use it if there is Git repository.

- Skill: `lemonorangeapple/git-backup` (Agent Skill)
- Install (CLI): `npx skillmds@latest add lemonorangeapple/git-backup`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lemonorangeapple/git-backup/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lemonorangeapple (https://skillmd.com/u/lemonorangeapple)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lemonorangeapple/git-backup

---


# 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**:
  1. Detect file changes
  2. Automatically stage changed files
  3. Generate commit message following Conventional Commits
  4. Create local commit

### Strategy 2: Never create commits
- **Use case**: Temporary files, test files, large binaries
- **Workflow**:
  1. Detect file changes
  2. Display change status only, no Git operations
  3. User manages these files manually

### Strategy 3: Ask user to create commit
- **Use case**: Daily development work
- **Workflow**:
  1. Detect file changes
  2. Display change summary
  3. Ask user if they want to commit
  4. Execute based on user choice

## Commit Message Convention (Conventional Commits)

### Format
```
<type>(<scope>): <description>

[optional body]

[optional footer]
```

### Type Definitions
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation update
- `style`: Code formatting
- `refactor`: Code refactoring
- `test`: Test related
- `chore`: 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
1. **Git repo not exists** → Prompt user to initialize repo
2. **File conflicts** → Show conflicted files, suggest resolution
3. **Commit message too long** → Auto-truncate or prompt user

### Rollback Mechanism
- Keep last 10 commit records
- Support `git reset` to specific version

## Usage Examples

### Example 1: Config File Backup
```bash
# Strategy 1: Auto-commit
Detecting config.json change
Staging file...
Creating commit: feat(config): update backup settings
```

### Example 2: Temporary File Handling
```bash
# Strategy 2: No commit
Detecting temp.log change
File not in version control (user chose not to commit)
```

### Example 3: Interactive Confirmation
```bash
# Strategy 3: Ask user
Detecting src/main.py change
Change summary:
- Modified 3 functions
- Added 2 new methods

Create commit? (y/n)
```

