git rm
The following examples assume you already have a repository in place to work with. If not, see git-init.
Remove from a Initialized Repository
This will stage the specified file for removal from the Repo:
Git
$ git rm <file>
LibGit2Sharp
using (var repo = new Repository("<repoPath>"))
{
// Removes the file
repo.Index.Remove("<file>");
}Example Code:
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
repo.Index.Remove("<file>");
// Commit to the repository
Commit commit = repo.Commit(message, author, committer);
}
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
