diff --git a/src/Commands/Discard.cs b/src/Commands/Discard.cs
index eaf5f844d..d358d6d86 100644
--- a/src/Commands/Discard.cs
+++ b/src/Commands/Discard.cs
@@ -12,15 +12,16 @@ public static class Discard
///
///
///
+ ///
///
- public static async Task AllAsync(string repo, bool includeIgnored, Models.ICommandLog log)
+ public static async Task AllAsync(string repo, bool includeIgnored, bool includeUntracked, Models.ICommandLog log)
{
var changes = await new QueryLocalChanges(repo).GetResultAsync().ConfigureAwait(false);
try
{
foreach (var c in changes)
{
- if (c.WorkTree == Models.ChangeState.Untracked ||
+ if ((c.WorkTree == Models.ChangeState.Untracked && includeUntracked) ||
c.WorkTree == Models.ChangeState.Added ||
c.Index == Models.ChangeState.Added ||
c.Index == Models.ChangeState.Renamed)
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 6784923ce..028c76431 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -325,6 +325,7 @@
All local changes in working copy.
Changes:
Include ignored files
+ Include untracked files
{0} changes will be discarded
You can't undo this action!!!
Bookmark:
diff --git a/src/ViewModels/Discard.cs b/src/ViewModels/Discard.cs
index 1fcda9049..41144d959 100644
--- a/src/ViewModels/Discard.cs
+++ b/src/ViewModels/Discard.cs
@@ -10,6 +10,12 @@ public bool IncludeIgnored
get;
set;
} = false;
+
+ public bool IncludeUntracked
+ {
+ get;
+ set;
+ } = false;
}
public class DiscardSingleFile
@@ -65,7 +71,7 @@ public override async Task Sure()
Use(log);
if (Mode is DiscardAllMode all)
- await Commands.Discard.AllAsync(_repo.FullPath, all.IncludeIgnored, log);
+ await Commands.Discard.AllAsync(_repo.FullPath, all.IncludeIgnored, all.IncludeUntracked, log);
else
await Commands.Discard.ChangesAsync(_repo.FullPath, _changes, log);
diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs
index 9372f309f..54c936403 100644
--- a/src/ViewModels/Pull.cs
+++ b/src/ViewModels/Pull.cs
@@ -125,7 +125,7 @@ public override async Task Sure()
{
if (DiscardLocalChanges)
{
- await Commands.Discard.AllAsync(_repo.FullPath, false, log);
+ await Commands.Discard.AllAsync(_repo.FullPath, false, true, log);
}
else
{
diff --git a/src/Views/Discard.axaml b/src/Views/Discard.axaml
index 1699b0517..fa68bb984 100644
--- a/src/Views/Discard.axaml
+++ b/src/Views/Discard.axaml
@@ -24,7 +24,7 @@
-
+
+
+