1) I tried using repo.Index.Remove(item.Filename);
, but it's giving me:
Additional information: Unable to remove file 'file.txt'. Its current status is 'Modified'.
I need to find a way to do git rm file.txt -f
(i.e. force removal).
2) I need a way to do git rm file.txt --cached
so that the file is only removed from the repository (staged for removal), but still keeping it in the filesystem. Is there a way to do this in LibGit2Sharp?
3) Is it OK to call repo.Index.Remove()
if the given path has never been part of the repository (i.e. the file is untracked)?