- Notifications
You must be signed in to change notification settings - Fork 916
git branch
nulltoken edited this page Nov 8, 2013 · 14 revisions
$ git branch using(varrepo=newRepository("path/to/your/repo")){foreach(Branchbinrepo.Branches.Where(b =>!b.IsRemote)){Console.WriteLine(string.Format("{0}{1}",b.IsCurrentRepositoryHead?"*":" ",b.Name));}}$ git branch --contains <commit> using(varrepo=newRepository("path/to/your/repo")){conststringcommitSha="5b5b025afb0b4c913b4c338a42934a3863bf3644";foreach(BranchbinListBranchesContainingCommit(repo,commitSha)){Console.WriteLine(b.Name);}}privateIEnumerable<Branch>ListBranchesContainingCommit(Repositoryrepo,stringcommitSha){foreach(varbranchinrepo.Branches){varcommits=repo.Commits.QueryBy(newFilter{Since=branch}).Where(c =>c.Sha==commitSha);if(!commits.Any())continue;yieldreturnbranch;}}$ git branch develop using(varrepo=newRepository("path/to/your/repo")){repo.CreateBranch("develop");}$ git branch other HEAD~1 using(varrepo=newRepository("path/to/your/repo")){repo.CreateBranch("other","HEAD~1");}To be done
To be done
To be done
To be done