diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index ebc38d78f..63f134cfb 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -123,6 +123,7 @@
SHA
Subject
Custom Action
+ Drop Commit
Interactively Rebase ${0}$ on ${1}$
Merge to ${0}$
Merge ...
diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs
index 4d119f98c..c71238296 100644
--- a/src/ViewModels/Histories.cs
+++ b/src/ViewModels/Histories.cs
@@ -617,6 +617,17 @@ public ContextMenu CreateContextMenuForSelectedCommits(List selec
e.Handled = true;
};
menu.Items.Add(revert);
+
+ var drop = new MenuItem();
+ drop.Header = App.Text("CommitCM.Drop");
+ drop.Icon = App.CreateMenuIcon("Icons.Clear");
+ drop.Click += async (_, e) =>
+ {
+ var parent = await new Commands.QuerySingleCommit(_repo.FullPath, commit.Parents[0]).GetResultAsync();
+ await App.ShowDialog(new InteractiveRebase(_repo, current, parent, Models.InteractiveRebaseAction.Drop));
+ e.Handled = true;
+ };
+ menu.Items.Add(drop);
}
if (current.Head != commit.SHA)
diff --git a/src/ViewModels/InteractiveRebase.cs b/src/ViewModels/InteractiveRebase.cs
index 78d806008..2dc437a6b 100644
--- a/src/ViewModels/InteractiveRebase.cs
+++ b/src/ViewModels/InteractiveRebase.cs
@@ -123,9 +123,8 @@ public CommitDetail DetailContext
private set;
}
- public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit on)
+ public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit on, Models.InteractiveRebaseAction lastAction = Models.InteractiveRebaseAction.Pick)
{
- var repoPath = repo.FullPath;
_repo = repo;
Current = current;
@@ -135,7 +134,7 @@ public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit o
Task.Run(async () =>
{
- var commits = await new Commands.QueryCommitsForInteractiveRebase(repoPath, on.SHA)
+ var commits = await new Commands.QueryCommitsForInteractiveRebase(repo.FullPath, on.SHA)
.GetResultAsync()
.ConfigureAwait(false);
@@ -143,14 +142,17 @@ public InteractiveRebase(Repository repo, Models.Branch current, Models.Commit o
for (var i = 0; i < commits.Count; i++)
{
var c = commits[i];
- list.Add(new InteractiveRebaseItem(c.Commit, c.Message, i < commits.Count - 1));
+ var item = new InteractiveRebaseItem(c.Commit, c.Message, i < commits.Count - 1);
+ if (i == commits.Count - 1)
+ item.Action = lastAction;
+ list.Add(item);
}
Dispatcher.UIThread.Post(() =>
{
Items.AddRange(list);
if (list.Count > 0)
- SelectedItem = list[0];
+ SelectedItem = lastAction == Models.InteractiveRebaseAction.Pick ? list[0] : list[^1];
IsLoading = false;
});
});