From 400d6e91ee4c0651c55bb1ab79081796020ca25a Mon Sep 17 00:00:00 2001 From: Philippe Miossec Date: Fri, 7 Oct 2022 23:44:10 +0200 Subject: [PATCH] FormRebase: select first parent which is a better default selection due to how rebase onto is working (the selected revision is excluded from the rebase --as it is the "base") So if the user want to rebase only one commit (which is not so rare), he only has to validate the selection... --- GitUI/CommandsDialogs/FormRebase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GitUI/CommandsDialogs/FormRebase.cs b/GitUI/CommandsDialogs/FormRebase.cs index 748999f17c2..6bf3f7384de 100644 --- a/GitUI/CommandsDialogs/FormRebase.cs +++ b/GitUI/CommandsDialogs/FormRebase.cs @@ -386,7 +386,9 @@ private void btnChooseFromRevision_Click(object sender, EventArgs e) try { AppSettings.ShowStashes = false; - using FormChooseCommit chooseForm = new(UICommands, txtFrom.Text, showCurrentBranchOnly: true); + ObjectId firstParent = UICommands.GitModule.RevParse("HEAD~"); + string preSelectedCommit = !string.IsNullOrWhiteSpace(txtFrom.Text) ? txtFrom.Text : firstParent?.ToString() ?? string.Empty; + using FormChooseCommit chooseForm = new(UICommands, preSelectedCommit, showCurrentBranchOnly: true); if (chooseForm.ShowDialog(this) == DialogResult.OK && chooseForm.SelectedRevision is not null) { txtFrom.Text = chooseForm.SelectedRevision.ObjectId.ToShortString();