use*_*302 16

以下适用于我:

public bool HasUncommittedChanges
{
    get
    {
        using (var repo = new Repository(repositoryRoot))
        {
            RepositoryStatus status = repo.RetrieveStatus();
            return status.IsDirty;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)


per*_*erh 5

您可以使用repository.Diff.Compare()

    /// <summary>
    ///   Show changes between the working directory and the index.
    /// </summary>
    /// <param name = "paths">The list of paths (either files or directories) that should be compared.</param>
    /// <returns>A <see cref = "TreeChanges"/> containing the changes between the working directory and the index.</returns>
    public virtual TreeChanges Compare(IEnumerable<string> paths = null)
Run Code Online (Sandbox Code Playgroud)

完全不经过任何路径都应该进行所有更改。


小智 5

以下代码行将提供文件名和该文件的状态。

foreach (var item in repo1.RetrieveStatus())
{
  Console.WriteLine(item.FilePath);
  Console.WriteLine(item.State);
}    
Run Code Online (Sandbox Code Playgroud)