Skip to content

Comments

Fix revert button to actually discard changes on staged files#1024

Open
thisisharsh7 wants to merge 1 commit intogeneralaction:mainfrom
thisisharsh7:fix-revert-button-staged-files
Open

Fix revert button to actually discard changes on staged files#1024
thisisharsh7 wants to merge 1 commit intogeneralaction:mainfrom
thisisharsh7:fix-revert-button-staged-files

Conversation

@thisisharsh7
Copy link
Contributor

The "Revert file changes" button wasn't working correctly for staged files. It would only unstage them instead of actually discarding the changes, making it functionally identical to the unstage button.

fixes #1022

@vercel
Copy link

vercel bot commented Feb 21, 2026

@thisisharsh7 is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Fixed the revertFile function to actually discard changes on staged files instead of just unstaging them. The previous code checked if a file was staged and only ran git reset HEAD which kept working directory changes, making it functionally identical to the unstage button. The fix removes this check, allowing git checkout HEAD to properly restore the file from HEAD and discard all changes (both staged and unstaged).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward bug fix that removes incorrect logic. The fix correctly makes the revert button discard all changes (both staged and unstaged) instead of just unstaging files. The implementation uses standard git commands and properly handles edge cases.
  • No files require special attention

Important Files Changed

Filename Overview
src/main/services/GitService.ts Removed staged file check to fix revert behavior - now properly discards all changes instead of just unstaging

Last reviewed commit: ce4193b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Revert button only unstages files instead of reverting changes

1 participant