Feature Request: Restore file to staged version (not just last commit) #40169
franciscorubin
started this conversation in
Git
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Zed team,
Right now, the “Restore File” command in Zed restores a file to its last committed version (equivalent to git restore path/to/file), which discards both staged and unstaged changes.
However, there’s currently no way to restore a file back to its staged state. To undo only the unstaged edits while keeping the staged ones intact.
This is a common Git workflow when iterating quickly:
Stage a set of changes you’re happy with.
Continue experimenting in the same file.
Decide you want to discard the new edits and go back to the staged version (not the commit).
In Git, this can be done via:
git restore --source=HEAD --worktree path/to/file
or
git restore --source=:0 path/to/file
It would be great if Zed added:
A “Restore to Staged” action in the Git panel or Command Palette,
Or an option in the “Restore File” dialog to choose the target (HEAD vs staged).
Beta Was this translation helpful? Give feedback.
All reactions