Kudu.Core.SourceControl.Git.LibGit2SharpRepository.CreateOrResetBranch C# (CSharp) Метод

CreateOrResetBranch() публичный Метод

public CreateOrResetBranch ( string branchName, string startPoint ) : void
branchName string
startPoint string
Результат void
        public void CreateOrResetBranch(string branchName, string startPoint)
        {
            using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
            {
                if (string.IsNullOrWhiteSpace(startPoint))
                {
                    var branch = repo.GetOrCreateBranch(branchName);
                    repo.Checkout(branch);
                }
                else
                {
                    var commit = repo.Lookup<Commit>(startPoint);
                    if (commit == null)
                    {
                        throw new LibGit2Sharp.NotFoundException(string.Format("Start point \"{0}\" for reset was not found.", startPoint));
                    }
                    var branch = repo.GetOrCreateBranch(branchName);
                    repo.Checkout(branch);
                    repo.Reset(ResetMode.Hard, commit);
                }
            }
        }