feature: supports reset branch to selected commit without checkout (#1247) (#1318)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-05-20 12:24:07 +08:00
parent 12d2b7721c
commit f9b6116a76
No known key found for this signature in database
20 changed files with 144 additions and 97 deletions

View file

@ -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();

View file

@ -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}";
}
}
}