libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.12k stars 878 forks source link

Question: How to get incoming changes? #2034

Closed No1e closed 1 year ago

No1e commented 1 year ago

Hi folks,

I'm new to libgit2sharp. Because of lack of documentation I was not able to find the solution. I hope that somebody can help me out.

What I want to do is to periodically check and get incoming changes (commits).

Lets say that I initially clone the remote repository by using Repository.Clone with CloneOptions by specifying CredentialsProvider. After that I want to periodically check for incoming changes, to find out if local repository is behind the remote repository, and if yes to find out which commits are new and to get them.

I tried to check if local branch is behind of remote branch, by I always get BehindBy 0 `using (var repository = new Repository(workDir)) { if (branch.TrackingDetails.BehindBy > 0) {

} }`

How can I do this?

Thank you and best regards, Nole