public void Branch()
{
//Get the current branch
var branch = repo.CurrentBranch;
Console.WriteLine("Current branch is " + branch.Name);
//Another way to get the current branch
Branch head = repo.Head;
// check if head == master
Debug.Assert(head.Name == "master");
//Get master branch
var master = new Branch(repo, "master");
Debug.Assert(master == repo.Get <Branch>("master"));
//Get the abbreviated hash of the last commit on master
Console.WriteLine(master.CurrentCommit.ShortHash);
//Create a new branch
var b = GitSharp.Branch.Create(repo, "foo");
// Switching to our new branch
b.Checkout();
//Check if foo is current branch
Debug.Assert(b.IsCurrent);
//Reset the branch to a previous commit (hard or soft or mixed)
master.Reset("HEAD^", ResetBehavior.Hard);
master.Reset("49322bb17d3acc9146f98c97d078513228bbf3c0", ResetBehavior.Soft);
master.Reset("master", ResetBehavior.Mixed);
}