Performing a “fast-forward” merge with Rugged

前端 未结 1 593
鱼传尺愫
鱼传尺愫 2021-01-16 05:46

Using Rugged, what\'s the canonical way to perform a fast-forward \"merge\"?

From here I found one possible lead:

# Move branch forward
# Since there         


        
相关标签:
1条回答
  • 2021-01-16 05:57

    There is no need for an operation called "fast-forward merge" libgit2 since a so-called ff-merge is updating the current branch to whatever commit is on the other branch, which does exist.

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

    will update the workdir to what the other side has, and then set the current branch to point to whatever the commit at the tip of the branch to "merge", which is what an ff does.

    0 讨论(0)
提交回复
热议问题