Git Ops Skill
This skill provides utilities for interacting with Git repositories directly from the workspace.
Core Capabilities
- Status: Check repository state (modified files, staged changes).
- Commit: Create meaningful commits with messages.
- Diff: Inspect changes before committing.
- Branch Management: Create, list, and switch branches.
- Log: View commit history.
Dependencies
git(command-line tool)- User must authorize git commands (standard Agent permission flow).
Workflow Examples
1. Check Status
git status
2. Stage and Commit
# Add specific files
git add path/to/file.ext
# Or add all changes
git add .
# Commit with message
git commit -m "feat: implement user login"
3. View Changes
# Unstaged changes
git diff
# Staged changes
git diff --staged
4. Create and Checkout Branch
# Create new branch
git branch feature/new-api
# Switch to branch
git checkout feature/new-api
# Or create and switch in one command
git checkout -b feature/new-api
5. View Recent Commits
# Concise log
git log --oneline -n 5
Best Practices
- Atomic Commits: Keep changes small and focused.
- Clear Messages: Use conventional commits format (feat:, fix:, docs:).
- Check Before Committing: Always run
git statusorgit difffirst to avoid unintended inclusions. - Branching: Work in feature branches, not main/master directly.