refactor: use git restore instead of git reset to unstage local changes (#1373)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-30 09:43:45 +08:00
parent 46231a759c
commit e40ca4bbe0
No known key found for this signature in database
3 changed files with 13 additions and 5 deletions

View file

@ -5,11 +5,15 @@ namespace SourceGit.Commands
{
public class Restore : Command
{
public Restore(string repo)
public Restore(string repo, bool onlyStaged)
{
WorkingDirectory = repo;
Context = repo;
Args = "restore . --source=HEAD --staged --worktree --recurse-submodules";
if (onlyStaged)
Args = "restore --source=HEAD --staged .";
else
Args = "restore --source=HEAD --staged --worktree --recurse-submodules .";
}
public Restore(string repo, List<string> files, string extra)