我想将自己的开发与LibGit2Sharp合并到我的master分支中,但是在GitHub wiki of LibGit2Sharp上找不到任何示例。 我该怎么办?
代码段:
using (var repo = new Repository(repoDirectory))
{
var masterBranch = repo.Branches["master"];
var developBranch = repo.Branches["develop"];
Commands.Checkout(repo, masterBranch);
// merge dev in master
// tag master
Commands.Checkout(repo, developBranch);
// merge master in dev
}
答案 0 :(得分:0)
我找到了解决方案,我不确定是否可以通过其他方式完成,但我可以。
using (var repo = new Repository(repoDirectory))
{
var masterBranch = repo.Branches["master"];
var developBranch = repo.Branches["develop"];
var merger = new Signature(AuthorName, AuthorEmail, DateTime.Now);
Commands.Checkout(repo, masterBranch);
repo.Merge(developBranch, merger, new MergeOptions());
repo.ApplyTag("v0.1");
Commands.Checkout(repo, developBranch);
repo.Merge(masterBranch, merger, new MergeOptions());
}