diff --git a/src/Commands/Stash.cs b/src/Commands/Stash.cs
index 223bfcd2..d2e12be8 100644
--- a/src/Commands/Stash.cs
+++ b/src/Commands/Stash.cs
@@ -73,21 +73,27 @@ namespace SourceGit.Commands
return Exec();
}
- public bool Apply(string name)
+ public bool Apply(string name = null)
{
- Args = $"stash apply --index -q {name}";
+ Args = "stash apply -q";
+ if (!string.IsNullOrEmpty(name))
+ Args += $" \"{name}\"";
return Exec();
}
- public bool Pop(string name)
+ public bool Pop(string name = null)
{
- Args = $"stash pop --index -q {name}";
+ Args = "stash pop -q";
+ if (!string.IsNullOrEmpty(name))
+ Args += $" \"{name}\"";
return Exec();
}
- public bool Drop(string name)
+ public bool Drop(string name = null)
{
- Args = $"stash drop -q {name}";
+ Args = "stash drop -q";
+ if (!string.IsNullOrEmpty(name))
+ Args += $" \"{name}\"";
return Exec();
}
diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs
index d2d0c2f3..556c99ea 100644
--- a/src/Models/RepositorySettings.cs
+++ b/src/Models/RepositorySettings.cs
@@ -182,6 +182,12 @@ namespace SourceGit.Models
set;
} = false;
+ public bool AutoRestoreAfterStash
+ {
+ get;
+ set;
+ } = false;
+
public string PreferedOpenAIService
{
get;
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 5124eb05..631722ad 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -640,6 +640,8 @@
Private SSH key store path
START
Stash
+ Auto-restore after stashing
+ Your working files remain unchanged, but a stash is saved.
Include untracked files
Keep staged files
Message:
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 4d2dfedb..b220b9ae 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -644,6 +644,8 @@
SSH密钥文件
开 始
贮藏(stash)
+ 贮藏后自动恢复工作区
+ 工作区文件保持未修改状态,但贮藏内容已保存。
包含未跟踪的文件
保留暂存区文件
信息 :
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 421dbd26..948cb2a8 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -643,6 +643,8 @@
SSH 金鑰檔案
開 始
擱置變更 (stash)
+ 暫存後自動復原工作區
+ 工作區檔案保持未修改,但暫存內容已儲存。
包含未追蹤的檔案
保留已暫存的變更
擱置變更訊息:
diff --git a/src/ViewModels/StashChanges.cs b/src/ViewModels/StashChanges.cs
index fd937bdd..3b5608f7 100644
--- a/src/ViewModels/StashChanges.cs
+++ b/src/ViewModels/StashChanges.cs
@@ -36,6 +36,12 @@ namespace SourceGit.ViewModels
set => _repo.Settings.KeepIndexWhenStash = value;
}
+ public bool AutoRestore
+ {
+ get => _repo.Settings.AutoRestoreAfterStash;
+ set => _repo.Settings.AutoRestoreAfterStash = value;
+ }
+
public StashChanges(Repository repo, List changes, bool hasSelectedFiles)
{
_repo = repo;
@@ -84,6 +90,9 @@ namespace SourceGit.ViewModels
succ = StashWithChanges(_changes);
}
+ if (AutoRestore && succ)
+ succ = new Commands.Stash(_repo.FullPath).Apply();
+
CallUIThread(() =>
{
_repo.MarkWorkingCopyDirtyManually();
diff --git a/src/Views/StashChanges.axaml b/src/Views/StashChanges.axaml
index 772b09e6..2879c7e7 100644
--- a/src/Views/StashChanges.axaml
+++ b/src/Views/StashChanges.axaml
@@ -11,7 +11,7 @@
-
+
-
+
+