internal static Branch StartNewBranch(this Flow gitFlow, GitFlowSetting originationBranch, GitFlowSetting branchBase, string leafname, bool shouldFetchRemote = false, bool trackRemote = false) { //TODO: Handle fetching from remote if (!IsOnSpecifiedBranch(gitFlow, originationBranch)) { var currentBranch = gitFlow.Repository.Checkout(gitFlow.GetBranch(originationBranch)); //TODO: Handle non-clean checkout exceptions // Don't know if this check really is needed if (currentBranch?.FriendlyName != gitFlow.GetPrefixByBranch(originationBranch)) { return(null); } } var newBranchName = $"{gitFlow.GetPrefixByBranch(branchBase)}{leafname}"; var newBranch = gitFlow.Repository.AddGetBranch(newBranchName, track: trackRemote); //var newBranch = gitFlow.Repository.CreateBranch($"{gitFlow.GetPrefixByBranch(branchBase)}{leafname}"); return(gitFlow.Repository.Checkout(newBranch)); }
internal static string GetFullBranchName(this Flow gitFlow, GitFlowSetting branch, string leafname) { return(GetFullBranchName(gitFlow.GetPrefixByBranch(branch), leafname)); }
internal static Branch GetBranch(this Flow gitFlow, GitFlowSetting branch, string leafname = "") { return(gitFlow.Repository.Branches[gitFlow.GetPrefixByBranch(branch) + leafname]); }
internal static IEnumerable <BranchInfo> GetAllBranchesByPrefix(this Flow gitFlow, GitFlowSetting setting) { var prefix = gitFlow.GetPrefixByBranch(setting); return(gitFlow.GetAllBranchesByPrefix(prefix)); }