在Git中,我可以使用以下命令获取与合并相关的所有提交:
bases=$(git merge-base --all --octopus A B C)
git log --pretty=%H --ancestry-path A B C --not $bases
echo $bases
LibGit2Sharp中是否有相同的内容?
答案 0 :(得分:1)
repo.ObjectDatabase.FindMergeBase()
应该有助于解决第一步
/// <summary>
/// Find the best possible merge base given two or more <see cref="Commit"/> according
/// to the <see cref="MergeBaseFindingStrategy"/>.
/// </summary>
/// <param name="commits">
/// The <see cref="Commit"/>s for which to find the merge base.
/// </param>
/// <param name="strategy">
/// The strategy to leverage in order to find the merge base.
/// </param>
/// <returns>The merge base or null if none found.</returns>
public virtual Commit FindMergeBase(IEnumerable<Commit> commits,
MergeBaseFindingStrategy strategy)
repo.Commits.QueryBy(new CommitFilter { Since = commits, Until = bestMergeBase });
将是枚举相关提交的方法。
是否会复制
--all
的{{1}}标志?
没有。只有最好的&#34;计算合并基数将由此方法返回。
libgit2中存在 git_merbe_bases_many() 函数,可以复制git merge-base
。但是,它尚未绑定到libGit2Sharp。您是否对此感兴趣,请在 issue tracker