Namespaces

Types in GitSharp

Type Repository

Namespace GitSharp

Interfaces IDisposable

Represents a git repository

Methods

Properties

Public instance methods

void Close()

Commit Commit(string message, Author author)

Commit staged changes and update HEAD
Parameters
string message

The commit message

Author author

The author of the content to be committed

Return
Commit

Returns the newly created commit

Commit Commit(string message)

Commit staged changes and update HEAD. The default git author from the config is used.
Parameters
string message

The commit message

Return
Commit

Returns the newly created commit

void Dispose()

T Get<T>(string identifier)

Access a git object by name, id or path. Use the type parameter to tell what kind of object you like to get. Supported types are

Branches, Commits or Tags may be accessed by name or reference expression. Currently supported are combinations of these:

Not supported is

Tree or Leaf (Blob) objects can be addressed by long hash or by their relative repository path

void SwitchToBranch(string name)

Check out the branch with the given name into the working directory and make it the current branch.

void SwitchToBranch(Branch branch)

Check out the given branch into the working directory and make it the current branch.

Public static methods

string FindRepository(string starting_directory)

Searches for a git repository starting at the given path. Starting at the given path, searches up the file hierarchy for the next .git directory.
Parameters
string starting_directory

The path where the search should start or null to start at the current directory

Return
string

A path if a repository has been found or null otherwise

bool IsValid(string path, bool bare)

Checks if the directory given by the path is a valid git repository.
Return
bool

Returns true if the given path is a valid git repository, false otherwise.

bool IsValid(string path)

Checks if the directory given by the path is a valid non-bare git repository. The given path may either point to the working directory or the repository's .git directory.
Return
bool

Returns true if the given path is a valid git repository, false otherwise.

Public properties

IDictionary<string, Branch> Branches get;

Config Config get;

Returns the git configuration containing repository-specific, user-specific and global settings.

Branch CurrentBranch get;

string Directory get;

Returns the path to the repository database (i.e. the .git directory).

Index Index get;

bool IsBare get;

Returns true if this repository is a bare repository. Bare repositories don't have a working directory and thus do not support some operations.

IDictionary<string, Ref> Refs get;

IDictionary<string, Branch> RemoteBranches get;

RepositoryStatus Status get;

Get the differences between the working directory and the index. Returns a data structure containing the results (like "git status").

IDictionary<string, Tag> Tags get;

string WorkingDirectory get;

Returns the path to the working directory (i.e. the parent of the .git directory of a non-bare repo). Returns null if it is a bare repository.