Question

Is there some way to get the list of stashes along with their names (and perhaps other info) and then see what files changes and the diffs?

I am using LibGit2Sharp

Was it helpful?

Solution

Diff is currently being implemented and should be available as part of the next version (v0.9.0).

  • "Tree to tree" list of changes is already available.
  • "Index to Workdir", "Blob to blob" and "Index to Tree" should be released in the following days

List of stashed changes is not implemented yet.

UPDATE: You could still access the latest stashed changes by directly accessing the reference. Something like this may work:

[SkippableFact]
public void CanRetrieveTheLatestStashedChanges()
{
    using (var repo = new Repository("path/to/the/repository"))
    {
        Reference latestStash = repo.Refs["refs/stash"];

        InconclusiveIf(() => latestStash == null, "Nothing has been stashed.");

        var changes = repo.Lookup<Commit>(latestStash.TargetIdentifier);
        Assert.NotNull(changes);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top