Skip to content

Conversation

@ybeapps
Copy link
Contributor

@ybeapps ybeapps commented Jan 28, 2026

Add reset file commands to compare view

Enable "Reset to Parent Revision" and "Reset to This Revision" commands in the compare view when selecting two commits. These commands now work for both single and multiple file selections in the compare view.

also - fixed a bug for Added files and Removed files that had an error pathspec did not match any file(s) known to git

  • Add ResetToSourceRevisionAsync and ResetToTargetRevisionAsync methods
  • Add ResetMultipleToSourceRevisionAsync and ResetMultipleToTargetRevisionAsync methods
  • Update RevisionCompare constructor to accept Repository object for logging
  • Add CanResetFiles property to check if reset operations are available
  • Add reset menu items to context menu in RevisionCompare view
  • Parent Revision resets to compare source (StartPoint)
  • Current Revision resets to compare target (EndPoint)

* Add reset file commands to compare view

Enable "Reset to Parent Revision" and "Reset to This Revision" commands
in the compare view when selecting two commits. These commands now work
for both single and multiple file selections in the compare view.

- Add ResetToSourceRevisionAsync and ResetToTargetRevisionAsync methods
- Add ResetMultipleToSourceRevisionAsync and ResetMultipleToTargetRevisionAsync methods
- Update RevisionCompare constructor to accept Repository object for logging
- Add CanResetFiles property to check if reset operations are available
- Add reset menu items to context menu in RevisionCompare view
- Parent Revision resets to compare source (StartPoint)
- Current Revision resets to compare target (EndPoint)

* Fix reset file commands for deleted files in compare view

When resetting a file to a revision where it is deleted, use 'git rm'
instead of 'git checkout' to properly remove the file from both the
working directory and the index.

- Add new Remove command for git rm operations
- Update ResetToSourceRevisionAsync to handle Added files (don't exist in source)
- Update ResetToTargetRevisionAsync to handle Deleted files (don't exist in target)
- Update multiple file reset methods to separate files into checkout vs remove lists
- Pass Change object instead of just path string to enable state checking
- Use --force and --ignore-unmatch flags for robust file removal

Fixes the "pathspec did not match any file(s) known to git" error when
trying to reset deleted files to the revision where they are deleted.

* Apply deleted file fix to single commit view reset commands

Apply the same deleted/added file handling to CommitDetail (single
commit view) that was previously applied to RevisionCompare.

- Update ResetToThisRevisionAsync to handle Deleted files
- Update ResetToParentRevisionAsync to handle Added files
- Update ResetMultipleToThisRevisionAsync to separate deleted files
- Update ResetMultipleToParentRevisionAsync to separate added files
- Change method signature to accept Change object instead of path string
- Update all call sites to pass Change object instead of path

This fixes the same "pathspec did not match any file(s) known to git"
error when resetting deleted files in single commit view.

---------

Co-authored-by: Claude <noreply@anthropic.com>
@ybeapps ybeapps changed the title Add reset file commands to compare view (#3) feat: Add reset file commands to compare view (#3) Jan 28, 2026
love-linger added a commit that referenced this pull request Jan 29, 2026
…etails panel (#2079)

Better handle for `added/deleted/renamed` file changes

Co-authored-by: ybeapps <ybeapps@gmail.com>
Signed-off-by: leo <longshuang@msn.cn>
@love-linger
Copy link
Collaborator

I picked and modified the optimizations for the Reset to This/Parent Revision function in Commit Details panel.

love-linger added a commit that referenced this pull request Jan 29, 2026
…etails panel (#2079)

Better handle for `added/deleted/renamed` file changes

Co-authored-by: ybeapps <ybeapps@gmail.com>
Signed-off-by: leo <longshuang@msn.cn>
love-linger added a commit that referenced this pull request Jan 29, 2026
…cted change(s) in revision compare view (#2079)

Co-authored-by: ybeapps <ybeapps@gmail.com>
Signed-off-by: leo <longshuang@msn.cn>
@love-linger
Copy link
Collaborator

I've pushed my implemetation for this feature

@ybeapps
Copy link
Contributor Author

ybeapps commented Jan 29, 2026

Cool do you want me to test it? What is the next step

@love-linger
Copy link
Collaborator

I'm very glad that you can help testing it.

love-linger added a commit that referenced this pull request Jan 29, 2026
…cted change(s) in compare view (#2079)

Signed-off-by: leo <longshuang@msn.cn>
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.

2 participants