9

I'm trying to merge changes from the remote branch into the local repository, however I've been unable to get this to work properly -- likely misunderstanding of the implementation. Fetching seems to work fine, as I can see the updates on the server, but I think I'm breaking something when attempting to pull.

I've tried:

repo.Checkout( branch.TrackedBranch, CheckoutOptions.None, OnCheckoutProgress );

This seems to do what you would expect from a Clone call. I can also not find a method to merge. As I've read, git pull is just like calling a fetch, then a merge.

I've looked at some of the tests in the repo, such as the MergeFixture, but it didn't seem to be what I was hoping it would be.

5
  • This would be much better asked on github.com/libgit2/libgit2sharp - it's a very active community. But to answer your question, merge is in progress. I'd be happy to discuss more on github... Commented Feb 6, 2013 at 19:50
  • 1
    I know it's active there, but I asked a question in the issue tracker, and was directed to ask here, so I have been :) Commented Feb 6, 2013 at 20:00
  • 2
    @EdwardThomson: Well, according to the README: "Usage or programming related question? Post it on StackOverflow using the tag libgit2sharp" ;-)
    – nulltoken
    Commented Feb 6, 2013 at 22:16
  • @nulltoken Thanks for the backup :-) Any idea how long we're talking about for merge implementation? I was using your GitSharp first, and it seems a bit more complete than LibGit2Sharp (I'm pretty sure merge was implemented). Commented Feb 7, 2013 at 2:03
  • "Any idea how long we're talking about for merge implementation?" -> Nope. I'll update the answer when it's ready.
    – nulltoken
    Commented Feb 7, 2013 at 9:04

2 Answers 2

12

Update as of April 2014

A convenience method of Pull has been added to LibGit2Sharp.

repo.Network.Pull(signature, pullOptions);

You can find more basic usages in the test fixtures.

2
7

Pull is indeed the combination of Fetch and Merge.

  • Fetch is ready
  • Merge is in progress (as stated by @EdwardThomson)

I've looked at some of the tests in the repo, such as the MergeFixture, but it didn't seem to be what I was hoping it would be.

As the complete merge process isn't available yet, there aren't many tests yet. However, MergeFixture.cs includes some aspects of the merge

  • Detection of conflicts/unmerged entries
  • Retrieval of the branch(es) being merged

There are other related bits in the CommitFixture.cs as well

  • Cleanup of potential merge metadata on Commit
  • Automatic inclusion of parents when issue a merge Commit

Libgit2 also includes some lower level bits to deal with conflicts that have been resolved by the user.

Update

Merge feature is now available in LibGit2Sharp (see pull request #608)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.