Git Undo & Redo
grüt tracks every git operation you perform and provides undo/redo capability — so you can reverse a stage, uncommit, or revert to any previous state with confidence.
Quick Undo / Redo
| Key | Action |
|---|---|
| u | Undo the last git operation |
| Ctrl+r | Redo the last undone operation |
grüt maintains an operation stack for the current session. Pressing u reverses the most recent operation — for example, unstaging a file you just staged, or uncommitting the last commit (keeping changes in the working tree). Pressing Ctrl+r re-applies the undone operation.
Supported Undo Operations
The following operations can be undone:
- Stage → unstages the file (
git reset HEAD <file>) - Unstage → re-stages the file
- Commit → soft-resets to uncommit (
git reset --soft HEAD~1), keeping all changes staged - Discard changes → restores from reflog if possible
- Branch checkout → switches back to the previous branch
- Branch delete → recreates the branch at its last known commit
- Stash → pops the stash back
Reflog Integration
For operations that go beyond the current session, grüt integrates with
git reflog. The reflog panel shows a chronological list of
every HEAD movement in your repository — commits, checkouts, rebases,
resets, and more.
Open the reflog browser to see recent operations and jump to any previous state. Each entry shows the operation type, short description, and the commit hash at that point.
| Key | Action |
|---|---|
| j / k | Navigate reflog entries |
| Enter | View details for the selected entry |
| Ctrl+r | Reset to the selected reflog entry |
Safety Confirmations
Destructive operations always require explicit confirmation. When you attempt an action that could result in data loss — such as discarding unstaged changes, hard-resetting, or force-deleting a branch — grüt displays a confirmation dialog:
- The dialog describes exactly what will happen
- Press y to confirm or n to cancel
- Some operations show the number of affected files or commits
This safety net ensures you never accidentally lose work. Combined with reflog integration, grüt gives you a reliable path to recover from any mistake.
Next Steps
- Git Status & Staging — stage and unstage changes
- Git Stash — stash and restore changes
- Git Log — browse commit history