hopefully someone call help. First off, I am pretty new to git, so forgive me if I make some mistakes in explaining my question.
I would like to pull the source code as it exists up to a specific commit using the library using libgit2sharp. So if there is a history of
I would like to be able to pull the source code for 5, or any other number in that list. None of the source will be tagged so I have to use the commits for the pull. Hopefully someone can help.
I have looked at https://github.com/libgit2/libgit2sharp/wiki/git-pull but it does not appear to let me pass in a sha or commit id.
Edited my question to be clear I am using the library.
So another dev answered the question. All I needed to do was a clone, then a checkout against the commit I wanted to reset to. This seems to work the way I wanted.
//clone the master
dir = Path.Combine(localPath, "Target");
Directory.CreateDirectory(dir);
Repository.Clone(tfsUri, dir);
//reset master to the base of the branch
using (var localRepo = new Repository(dir))
{
var localCommit = localRepo.Lookup<Commit>(priorCommitId);
Commands.Checkout(localRepo, localCommit);
}
Not sure if this is what you meant @0andriy, but your comment was a bit confusing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With