32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
|
|
# 🛡️ Safety & Change Management
|
||
|
|
|
||
|
|
Grokkit is designed to work seamlessly with Git. Rather than creating redundant `.bak` files, we lean on Git's powerful version control to manage changes and rollbacks.
|
||
|
|
|
||
|
|
## The Safety Workflow
|
||
|
|
|
||
|
|
1. **Preview**: Every command that modifies files (like `edit`, `lint`, `docs`) shows a diff-style preview first.
|
||
|
|
2. **Confirm**: You must explicitly confirm (`y/N`) before any changes are written to disk.
|
||
|
|
3. **Git Integration**: Use Git to manage the "pre-staged," "staged," and "committed" degrees of change.
|
||
|
|
|
||
|
|
## Managing Undesired Changes
|
||
|
|
|
||
|
|
If you've applied a change that you don't like, Git makes it easy to roll back:
|
||
|
|
|
||
|
|
- **Unstaged changes**: If you haven't `git add`-ed the changes yet:
|
||
|
|
```bash
|
||
|
|
git restore <file>
|
||
|
|
```
|
||
|
|
- **Staged changes**: If you've already staged the changes:
|
||
|
|
```bash
|
||
|
|
git restore --staged <file>
|
||
|
|
git restore <file>
|
||
|
|
```
|
||
|
|
- **Committed changes**: If you've already committed the changes:
|
||
|
|
```bash
|
||
|
|
git revert HEAD
|
||
|
|
# or to reset to a previous state:
|
||
|
|
git reset --hard HEAD~1
|
||
|
|
```
|
||
|
|
|
||
|
|
By using Git, you have a complete audit trail and multiple levels of undo, ensuring your codebase remains stable even when experimenting with AI-driven refactors.
|