using LibGit2Sharp; // Open the repository using (var repo = new Repository("path/to/repository")) { // Check out the "master" branch repo.Checkout("master"); }
using LibGit2Sharp; // Open the repository using (var repo = new Repository("path/to/repository")) { // Check out the commit with SHA "abcdef" repo.Checkout("abcdef"); }Package Library: LibGit2Sharp is a Git client library for .NET and implements the Git core methods as well as popular high-level abstractions.