libgit2sharp
libgit2sharp copied to clipboard
how to checkout -b branch
apparently i am only able to checkout a branch and have it be detached.. is there a way to create a local branch with proper remote tracking info ?
You'd need to create the new branch using the CreateBranch method, then check it out.
Something like this based on info found in the wiki.
using (var repo = new Repository("path/to/your/repo"))
{
Branch branch = repo.CreateBranch("develop"); // Or repo.Branches.Add("develop", "HEAD");
Branch currentBranch = Commands.Checkout(repo , branch);
}