表演"快进"与Rugged合并

时间:2014-11-22 01:05:28

标签: libgit2 rugged

使用Rugged,执行快进"合并"是什么规范方法?


here我发现了一个可能的导致:

# Move branch forward
# Since there's no fast-forward merge in this lib yet, do it by hand.
br = repo.branch "master"
br.move 'master-old', true if br != nil
repo.create_branch 'master', commit_sha
#br.delete! # No real harm in this hanging around

但我很好奇这里是否还有改进的余地。

1 个答案:

答案 0 :(得分:1)

不需要称为"快进合并" libgit2,因为所谓的ff-merge正在将当前分支更新为另一个分支上的任何提交,这确实存在。

repo.checkout_tree(other_branch.target)
repo.references.update(repo.head.resolve, other_branch.target_id)

会将workdir更新为对方拥有的内容,然后将当前分支设置为指向分支顶端的提交,以及&#34; merge&#34;,这就是ff的作用。< / p>