Repository navigation
Revert a Change
Sometimes you want to throw away one change in a file and keep the rest. Revert does that for a single change. A "change" (git calls it a hunk) is one block of lines that differ, with unchanged lines around it.
You can revert in the Changes diff, in a commit's diff, and in the file editor. A commit's diff can also apply one of its changes to your working tree.

The first change of cart.ts with its Stage arrow and its Revert button (under the pointer) beside its line number.
Select a file under Changes to open its diff. Each change has two buttons on its first line, beside the working tree's line numbers:
- «, Stage this change, copies the change into the index (the staging area, what the next commit will hold).
- The curved arrow next to it, Revert this change, puts the staged version of those lines back in your working tree file.
In the inline layout, the same two buttons sit on the first line of each change: + to stage and the curved arrow to revert.
Revert always asks first. When you confirm, the file on disk changes and the diff reloads. A message says how many lines were discarded, with an Undo button that puts your lines back.
Revert is offered for Changes (the working tree against the index) and in the Changes tab that N changes in the status bar opens (the working tree against the last commit). A diff from Staged has Unstage this change instead.
If the file changed after the diff was shown, for example in another editor, nothing is reverted: a message asks you to check the diff and try again, so you never lose lines you have not seen.

Added lines in cart.ts with their green bar beside the line numbers: click it to revert them.
While you edit, colored bars beside the line numbers show what changed since the last commit (see Editor and Tabs). The pointer turns into a hand over a bar. Click it to revert that change:
- For added or modified lines, click the bar beside them.
- For deleted lines, click the small red wedge where they were.
After you confirm, the last commit's lines replace the change in the editor. This is an ordinary edit, the same as typing:
- Edit > Undo brings your lines back.
- Nothing is saved until you save the file, or until auto save does.
Conflict blocks have their own bar and are not reverted this way; use the conflict actions instead (see Resolving Conflicts).
[TODO:revert-change-commit.png]
A commit's diff in the History panel, with Revert under the pointer and the Apply arrow beside the change's line number.
Every diff that shows a commit, in the History panel or a commit tab, has two buttons on each change. A branch compare has them too.
- The curved arrow, Revert this change in the working tree, takes that change out of your working tree file. Its lines go back to how they were before the commit.
- », Apply this change to the working tree, copies that change into your file, like cherry-picking (copying a commit onto your branch) one change instead of a whole commit.
Inline, the same buttons sit on the first line of each change. Revert asks first, and both leave the index alone and offer Undo. If your file has changed too much around those lines, nothing happens and a message says so.
Compare with Revision and the diff of a revision against the working tree have Revert only, since their right side already is your file.
Like the staging view, a commit can show three columns: its parent, the commit and your Working Tree. Pick Three panes in the diff toolbar, or Side by side for commits in Settings > Git. The bands on the left show the commit's changes, with the same Revert and Apply buttons beside the parent's line numbers; the bands on the right show how your file differs from the commit. A merge commit shows parent 1, the merge and parent 2 instead (see Merge Commits).
The two places compare with different versions, the same ones their colors show:
- The Changes diff compares the working tree with the index, so Revert brings back the staged lines. If you never staged the file, that is the last commit.
- The editor and the Changes tab compare with the last commit (HEAD), so Revert brings back the committed lines, even when a newer version is staged. The staged version stays staged.
- A commit's diff brings back the lines as they were in the commit's parent.
These pages are generated from docs/wiki. To correct something, open a pull request against the source file; edits made here are overwritten.
Using Nibtree
- Getting Started
- Welcome Screen
- Workspaces
- Files Panel
- File Operations
- File Icons
- Rounded Panels
- Editor and Tabs
- Pin Reorder and Wrap Tabs
- Single Tab Title
- Split Editor
- New File and Unsaved Changes
- Unload Hidden Tabs
- Editing Code
- Code Appearance
- Markdown Editor
- Image and PDF Preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and Replace
- Changes and Commits
- Sign In Prompts
- Commit Box Layout
- Repository Actions
- Commit Options
- Ignoring Files
- Diffs
- Inline Diffs
- Staging View
- Revert a Change
- Resolving Conflicts
- Merge Tool
- Blame
- History and Log
- Merge Commits
- Branches and Tags
- Branches Popup
- Remotes
- Stashes
- Shelf
- Git Menu
- Git Dialogs
- Interactive Rebase
- Worktrees
- AI Agents
- AI Tasks
- AI Usage
- Keep Computer Awake
- Submodules
- Git LFS
- GitHub
- Git Console
- Terminal
- Terminal Features
- Scripts
- Navigation
- Menus
- Settings
- Settings Search
- Color Themes
- Settings Terminal and Automation
- Settings Files
- Updates
- Status Bar and Help
- Notifications
- Memory Use
- Clear Cache
- MCP and CLI
- Git Mergetool
- Keyboard Shortcuts
- Keyboard Shortcuts Editor
- Troubleshooting
- Troubleshooting Git
Developers
- Developer Guide
- Architecture
- Project Layout
- Backend
- How Folder Watching Works
- Folder Watching Bugs We Fixed
- How Workspace Files Work
- How the Preview Scheme Works
- Backend Services
- How Terminal Features Work
- Terminal Bugs We Fixed
- Frontend
- How the Rich Markdown Editor Works
- Rich Markdown Bugs We Fixed
- Git Menu Links
- Menu Keys and Routing
- Frontend Modules
- Blame Bugs We Fixed
- Project Color And Title Bar
- One Diff View
- Diff Bugs We Fixed
- Merge Tool Layouts
- Merge Tool Bugs We Fixed
- Color Theme Bugs We Fixed
- How the Connected Diff Works
- Rounded Panels Bugs We Fixed
- Update Bugs We Fixed
- Status Bar Bugs We Fixed
- MCP and CLI Bugs We Fixed
- Repository Actions Bugs We Fixed
- How the Changes Tab Works
- CodeMirror Patterns
- How the Cursor Works
- How Editor Features Work
- How the Path Bar Works
- Commands and Events
- Settings Reference
- Commands Workspace and Changes
- Commands Branches and Remotes
- Commands History and Extras
- Commands App and Tools
- Testing
- Test Suites
- Debugging
- Debugging with MCP
- Measuring Setting Memory
- How Terminal Memory Is Measured
- How Markdown Diagrams Work
- Releases and CI
- Publishing the Wiki
- Versioning and Changelog
- Browser Version Packages
- Browser Release Checks
- Docker Image
- Platforms and Signing
- Windows Support
- Windows Bugs We Fixed
- Windows MCP and CLI
- Docs and Screenshots
- UI Library
- UI Library MCP
- UI Library Bugs
- UI Library Migration
- Contributing
How features work
- Welcome screen
- Workspaces and folders
- Files panel
- File operations
- File icons
- Editor and tabs
- Pin, reorder and wrap tabs
- Single tab title
- Split editor
- New File and unsaved changes
- Unload hidden tabs
- Editing code
- Code appearance
- Markdown editor
- Image and PDF preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and replace
- Changes and commits
- Sign-in prompts
- Commit box layout
- Repository actions
- Commit options
- Ignoring files
- Diffs
- Inline diffs
- Staging view
- Revert a change
- Resolving conflicts
- Merge tool
- Blame
- History and log
- Merge commits
- Commit tabs
- Branches and tags
- Branches popup
- Remotes
- Stashes
- Shelf
- Git menu
- Git dialogs
- Interactive rebase
- Worktrees
- AI agents
- AI usage
- Keep computer awake
- AI tasks
- Submodules
- Git LFS
- GitHub account
- Git Console
- Back and Forward
- Integrated terminal
- Scripts tool window
- Menu bar
- Settings
- Search in Settings
- Color themes
- Rounded panels
- Updates and release channels
- Status bar and help links
- Notifications
- Memory readout and memory log
- Clear Cache
- MCP server and command line tool
- git mergetool mode