Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Git add

treischl edited this page Jun 3, 2016 · 7 revisions

The following examples assume you already have a repository in place to work with. If not, see git-init.

Add to a non-bare repository

If you want to stage (add) a file in a repository that is checked out to the file system, you can stage a file with changes like so:

using (var repo = new Repository("path/to/your/repo"))
{
    // Stage the file
    repo.Index.Add("file/with/changes.txt");
}

Stage all working directory changes

Git

$ git add --all .

LibGit2Sharp

using (var repo = new Repository("path/to/your/repo"))
{
    Commands.Stage(repo, "*");
}

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.