GitSharp.NET的Git開發(fā)包
GitSharp 是 .NET 框架和 MONO 實現(xiàn)的 Git,旨在完全兼容 Git,也可作為輕量級的開發(fā)庫為那些需要 Git 特性的應(yīng)用以及訪問 Git 資料庫。
示例代碼:
//Opening an existing git repository
repo = new Repository("path/to/repo");
// Now suppose you have created some new files and want to commit them
repo.Index.Add("README", "License.txt");
Commit commit = repo.Commit("My first commit with gitsharp", new Author("henon", "[email protected]"));
// Easy, isn't it? Now let's have a look at the changes of this commit:
foreach (Change change in commit.Changes)
Console.WriteLine(change.Name + " " + change.ChangeType);
//Get the staged changes from the index
repo.Status.Added.Contains("README");
//Access and manipulate the configuration
repo.Config["core.autocrlf"] = "false";
評論
圖片
表情
