diff --git a/src/Commands/Branch.cs b/src/Commands/Branch.cs
index 9c396215..55c27843 100644
--- a/src/Commands/Branch.cs
+++ b/src/Commands/Branch.cs
@@ -31,6 +31,16 @@
return cmd.Exec();
}
+ public static bool ResetWithoutCheckout(string repo, string name, string to, Models.ICommandLog log)
+ {
+ var cmd = new Command();
+ cmd.WorkingDirectory = repo;
+ cmd.Context = repo;
+ cmd.Args = $"branch -f {name} {to}";
+ cmd.Log = log;
+ return cmd.Exec();
+ }
+
public static bool SetUpstream(string repo, string name, string upstream, Models.ICommandLog log)
{
var cmd = new Command();
diff --git a/src/Commands/UpdateRef.cs b/src/Commands/UpdateRef.cs
deleted file mode 100644
index 1e7bb239..00000000
--- a/src/Commands/UpdateRef.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace SourceGit.Commands
-{
- public class UpdateRef : Command
- {
- public UpdateRef(string repo, string refName, string toRevision)
- {
- WorkingDirectory = repo;
- Context = repo;
- Args = $"update-ref {refName} {toRevision}";
- }
- }
-}
diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml
index 30750931..337b0ce3 100644
--- a/src/Resources/Locales/de_DE.axaml
+++ b/src/Resources/Locales/de_DE.axaml
@@ -292,7 +292,6 @@
Ausgewähltes Repository bearbeiten
Führe benutzerdefinierte Aktion aus
Name der Aktion:
- Fast-Forward (ohne Auschecken)
Fetch
Alle Remotes fetchen
Aktiviere '--force' Option
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 19abf96b..f41b90e7 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -63,6 +63,7 @@
Push ${0}$
Rebase ${0}$ on ${1}$...
Rename ${0}$...
+ Reset ${0}$ to ${1}$...
Set Tracking Branch...
Branch Compare
Invalid upstream!
@@ -289,7 +290,6 @@
Edit Selected Repository
Run Custom Action
Action Name:
- Fast-Forward (without checkout)
Fetch
Fetch all remotes
Force override local refs
@@ -647,6 +647,9 @@
Reset Mode:
Move To:
Current Branch:
+ Reset Branch (Without Checkout)
+ Move To:
+ Branch:
Reveal in File Explorer
Revert Commit
Commit:
diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml
index e2b16329..15155dc7 100644
--- a/src/Resources/Locales/es_ES.axaml
+++ b/src/Resources/Locales/es_ES.axaml
@@ -292,7 +292,6 @@
Editar Repositorio Seleccionado
Ejecutar Acción Personalizada
Nombre de la Acción:
- Fast-Forward (sin checkout)
Fetch
Fetch todos los remotos
Utilizar opción '--force'
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml
index 0529702d..872fb2c6 100644
--- a/src/Resources/Locales/fr_FR.axaml
+++ b/src/Resources/Locales/fr_FR.axaml
@@ -275,7 +275,6 @@
Éditer le dépôt sélectionné
Lancer action personnalisée
Nom de l'action :
- Fast-Forward (sans récupération)
Fetch
Fetch toutes les branches distantes
Outrepasser les vérifications de refs
diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml
index 05fee42b..d46785d5 100644
--- a/src/Resources/Locales/it_IT.axaml
+++ b/src/Resources/Locales/it_IT.axaml
@@ -292,7 +292,6 @@
Modifica Repository Selezionato
Esegui Azione Personalizzata
Nome Azione:
- Avanzamento Veloce (senza verifica)
Recupera
Recupera da tutti i remoti
Forza la sovrascrittura dei riferimenti locali
diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml
index 48d55500..a20c5ddc 100644
--- a/src/Resources/Locales/ja_JP.axaml
+++ b/src/Resources/Locales/ja_JP.axaml
@@ -275,7 +275,6 @@
選択中のリポジトリを編集
カスタムアクションを実行
アクション名:
- (チェックアウトせずに)ブランチを早送りする
フェッチ
すべてのリモートをフェッチ
ローカル参照を強制的に上書き
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml
index 2a693151..db304f18 100644
--- a/src/Resources/Locales/pt_BR.axaml
+++ b/src/Resources/Locales/pt_BR.axaml
@@ -249,7 +249,6 @@
Editar Repositório Selecionado
Executar ação customizada
Nome da ação:
- Fast-Forward (sem checkout)
Buscar
Buscar todos os remotos
Buscar sem tags
diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml
index 77a7ba4f..11419b76 100644
--- a/src/Resources/Locales/ru_RU.axaml
+++ b/src/Resources/Locales/ru_RU.axaml
@@ -292,7 +292,6 @@
Редактировать выбранный репозиторий
Выполнить пользовательское действие
Имя действия:
- Быстрая перемотка вперёд (без проверки)
Извлечь
Извлечь все внешние репозитории
Разрешить опцию (--force)
diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml
index 02c138c6..89fd4e12 100644
--- a/src/Resources/Locales/ta_IN.axaml
+++ b/src/Resources/Locales/ta_IN.axaml
@@ -275,7 +275,6 @@
தேர்ந்தெடுக்கப்பட்ட களஞ்சியத்தைத் திருத்து
தனிப்பயன் செயலை இயக்கு
செயல் பெயர்:
- வேகமாக முன்னோக்கி (சரிபார்க்காமல்)
பெறு
எல்லா தொலைகளையும் பெறு
உள்ளக குறிப்புகளை கட்டாயமாக மீறு
diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml
index a3b63bde..18ba643e 100644
--- a/src/Resources/Locales/uk_UA.axaml
+++ b/src/Resources/Locales/uk_UA.axaml
@@ -279,7 +279,6 @@
Редагувати вибраний репозиторій
Виконати спеціальну дію
Ім'я дії:
- Перемотати (без перемкнуття)
Витягти
Витягти всі віддалені сховища
Примусово перезаписати локальні refs
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 6cd76db0..0357586a 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -65,8 +65,9 @@
拉回(pull) ${0}$
拉回(pull) ${0}$ 内容至 ${1}$...
推送(push)${0}$
- 变基(rebase) ${0}$ 分支至 ${1}$...
+ 变基(rebase) ${0}$ 至 ${1}$...
重命名 ${0}$...
+ 重置 ${0}$ 到 ${1}$...
切换上游分支 ...
分支比较
跟踪的上游分支不存在或已删除!
@@ -293,7 +294,6 @@
编辑仓库
执行自定义操作
自定义操作 :
- 快进(fast-forward,无需checkout)
拉取(fetch)
拉取所有的远程仓库
强制覆盖本地REFs
@@ -651,6 +651,9 @@
重置模式 :
提交 :
当前分支 :
+ 重置所选分支(非当前分支)
+ 重置点 :
+ 操作分支 :
在文件浏览器中查看
回滚操作确认
目标提交 :
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index c05587c6..c9f88912 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -67,6 +67,7 @@
推送 (push) ${0}$
重定基底 (rebase) ${0}$ 分支至 ${1}$...
重新命名 ${0}$...
+ 重設 ${0}$ 至 ${1}$...
切換上游分支...
分支比較
追蹤上游分支不存在或已刪除!
@@ -293,7 +294,6 @@
編輯存放庫
執行自訂動作
自訂動作:
- 快進 (fast-forward,無需 checkout)
提取 (fetch)
提取所有的遠端存放庫
強制覆寫本機 REFs
@@ -651,6 +651,9 @@
重設模式:
移至提交:
目前分支:
+ 重設選取的分支(非目前分支)
+ 重設位置 :
+ 選取分支 :
在檔案瀏覽器中檢視
復原操作確認
目標提交:
diff --git a/src/ViewModels/FastForwardWithoutCheckout.cs b/src/ViewModels/FastForwardWithoutCheckout.cs
deleted file mode 100644
index 53d69816..00000000
--- a/src/ViewModels/FastForwardWithoutCheckout.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using System.Threading.Tasks;
-
-namespace SourceGit.ViewModels
-{
- public class FastForwardWithoutCheckout : Popup
- {
- public Models.Branch Local
- {
- get;
- }
-
- public Models.Branch To
- {
- get;
- }
-
- public FastForwardWithoutCheckout(Repository repo, Models.Branch local, Models.Branch upstream)
- {
- _repo = repo;
- Local = local;
- To = upstream;
- }
-
- public override Task Sure()
- {
- _repo.SetWatcherEnabled(false);
- ProgressDescription = "Fast-Forward ...";
-
- var log = _repo.CreateLog("Fast-Forward (No checkout)");
- Use(log);
-
- return Task.Run(() =>
- {
- new Commands.UpdateRef(_repo.FullPath, Local.FullName, To.FullName).Use(log).Exec();
- log.Complete();
- CallUIThread(() =>
- {
- _repo.NavigateToCommit(To.Head);
- _repo.SetWatcherEnabled(true);
- });
- return true;
- });
- }
-
- private readonly Repository _repo = null;
- }
-}
diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs
index a3f63251..af8e4f85 100644
--- a/src/ViewModels/Repository.cs
+++ b/src/ViewModels/Repository.cs
@@ -1770,9 +1770,25 @@ namespace SourceGit.ViewModels
fastForward.Click += (_, e) =>
{
if (CanCreatePopup())
- ShowAndStartPopup(new FastForwardWithoutCheckout(this, branch, upstream));
+ ShowAndStartPopup(new ResetWithoutCheckout(this, branch, upstream));
e.Handled = true;
};
+ menu.Items.Add(fastForward);
+
+ var selectedCommit = (_histories?.DetailContext as CommitDetail)?.Commit;
+ if (selectedCommit != null && !selectedCommit.SHA.Equals(branch.Head, StringComparison.Ordinal))
+ {
+ var move = new MenuItem();
+ move.Header = App.Text("BranchCM.ResetToSelectedCommit", branch.Name, selectedCommit.SHA.Substring(0, 10));
+ move.Icon = App.CreateMenuIcon("Icons.Reset");
+ move.Click += (_, e) =>
+ {
+ if (CanCreatePopup())
+ ShowPopup(new ResetWithoutCheckout(this, branch, selectedCommit));
+ e.Handled = true;
+ };
+ menu.Items.Add(move);
+ }
var fetchInto = new MenuItem();
fetchInto.Header = App.Text("BranchCM.FetchInto", upstream.FriendlyName, branch.Name);
@@ -1785,7 +1801,6 @@ namespace SourceGit.ViewModels
e.Handled = true;
};
- menu.Items.Add(fastForward);
menu.Items.Add(new MenuItem() { Header = "-" });
menu.Items.Add(fetchInto);
}
diff --git a/src/ViewModels/ResetWithoutCheckout.cs b/src/ViewModels/ResetWithoutCheckout.cs
new file mode 100644
index 00000000..da2dbeaf
--- /dev/null
+++ b/src/ViewModels/ResetWithoutCheckout.cs
@@ -0,0 +1,53 @@
+using System.Threading.Tasks;
+
+namespace SourceGit.ViewModels
+{
+ public class ResetWithoutCheckout : Popup
+ {
+ public Models.Branch Target
+ {
+ get;
+ }
+
+ public object To
+ {
+ get;
+ }
+
+ public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Branch to)
+ {
+ _repo = repo;
+ _revision = to.Head;
+ Target = target;
+ To = to;
+ }
+
+ public ResetWithoutCheckout(Repository repo, Models.Branch target, Models.Commit to)
+ {
+ _repo = repo;
+ _revision = to.SHA;
+ Target = target;
+ To = to;
+ }
+
+ public override Task Sure()
+ {
+ _repo.SetWatcherEnabled(false);
+ ProgressDescription = $"Reset {Target.Name} to {_revision} ...";
+
+ var log = _repo.CreateLog($"Reset '{Target.Name}' to '{_revision}'");
+ Use(log);
+
+ return Task.Run(() =>
+ {
+ var succ = Commands.Branch.ResetWithoutCheckout(_repo.FullPath, Target.Name, _revision, log);
+ log.Complete();
+ CallUIThread(() => _repo.SetWatcherEnabled(true));
+ return succ;
+ });
+ }
+
+ private readonly Repository _repo = null;
+ private readonly string _revision = string.Empty;
+ }
+}
diff --git a/src/Views/FastForwardWithoutCheckout.axaml b/src/Views/FastForwardWithoutCheckout.axaml
deleted file mode 100644
index 16b40256..00000000
--- a/src/Views/FastForwardWithoutCheckout.axaml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Views/ResetWithoutCheckout.axaml b/src/Views/ResetWithoutCheckout.axaml
new file mode 100644
index 00000000..3808a8dd
--- /dev/null
+++ b/src/Views/ResetWithoutCheckout.axaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Views/FastForwardWithoutCheckout.axaml.cs b/src/Views/ResetWithoutCheckout.axaml.cs
similarity index 52%
rename from src/Views/FastForwardWithoutCheckout.axaml.cs
rename to src/Views/ResetWithoutCheckout.axaml.cs
index 0e3ba20d..9280c070 100644
--- a/src/Views/FastForwardWithoutCheckout.axaml.cs
+++ b/src/Views/ResetWithoutCheckout.axaml.cs
@@ -2,9 +2,9 @@ using Avalonia.Controls;
namespace SourceGit.Views
{
- public partial class FastForwardWithoutCheckout : UserControl
+ public partial class ResetWithoutCheckout : UserControl
{
- public FastForwardWithoutCheckout()
+ public ResetWithoutCheckout()
{
InitializeComponent();
}