-
Notifications
You must be signed in to change notification settings - Fork 892
git rm
Karel Kral edited this page Jul 2, 2021
·
3 revisions
The following examples assume you already have a repository in place to work with. If not, see git-init.
This will stage the specified file for removal from the Repo:
$ git rm <file>
using (var repo = new Repository("<repoPath>"))
{
// Removes the file. Path must be in Posix format (using '/' as path separator)
repo.Index.Remove("<file>");
}
using (var repo = new Repository("<repoPath>"))
{
// Create the committer's signature and commit
Signature author = new Signature("Author", "@Author", DateTime.Now);
Signature committer = author;
// Remove the file. Path must be in Posix format (using '/' as path separator)
repo.Index.Remove("<file>");
// Commit to the repository
Commit commit = repo.Commit(message, author, committer);
}