I'm trying my best to figure out how to unstage a file with libgit2sharp.
My current approach is to to remove the file from the index, but that seems to delete the file instead of unstaging it.
public bool Unstage(params string[] filePaths)
{
using (var repo = LocalRepo)
{
try
{
foreach (var filePath in filePaths)
{
repo.Index.Remove(filePath);
repo.Index.Write();
}
}
catch (Exception ex)
{
return false;
}
}
return true;
}
I've tried to do a soft reset as well, but I can't figure out how to pass in the filename or use the commitish parameter in one of the reset function overloads.
Been trying to follow this post: Why are there two ways to unstage a file in Git?, but I can't seem to figure out how to recreate that approach in libgit2sharp.