refactor: use git reset --hard HEAD to discard all changes and use git restore --staged to unstage changes in text diff view

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-02 12:50:58 +08:00
parent 78f9ae2fa9
commit f1052c3efc
No known key found for this signature in database
3 changed files with 5 additions and 29 deletions

View file

@ -1928,8 +1928,10 @@ namespace SourceGit.Views
{
if (change.DataForAmend != null)
new Commands.UnstageChangesForAmend(repo.FullPath, [change]).Exec();
else if (change.Index == Models.ChangeState.Renamed)
new Commands.Restore(repo.FullPath, [change.Path, change.OriginalPath], "--staged").Exec();
else
new Commands.Reset(repo.FullPath, [change]).Exec();
new Commands.Restore(repo.FullPath, [change.Path], "--staged").Exec();
}
else
{