return 将 git 上的所有提交提交到尚未合并的 master 分支的最简单方法是什么?

Whats the simplest way to return all commits on git to master branch that have not been merged already?

我正在使用 LigGit2Sharp。我试过使用

foreach (Commit commit in repo.Commits)
{
    foreach (var parent in commit.Parents)
    {
        //Console.WriteLine("{0} | {1}", commit.Sha, commit.MessageShort);
    }
}

但是这显示了所有提交历史...

您要做的是在两个 commit-ish(提交、树、标签...)之间创建一个过滤列表 (ICommitLog)。

这是获取两个分支之间的所有提交的示例;一个 "master" 分支和一个已对其进行更改但尚未合并到 "master":

的错误修复分支
public ICommitLog CommitList {
    get {
        var filter = new CommitFilter { 
            SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Time,
            Since = repo.Branches.Single (branch => branch.FriendlyName == "bugfix1234");
            Until = repo.Branches.Single (branch => branch.FriendlyName == "master");           
        };
        return repo.Commits.QueryBy (filter);
    }
}