Namespaces

Types in GitSharp

Type Index

Namespace GitSharp

Represents the index of a git repository which keeps track of changes that are about to be committed.

Methods

Properties

Public instance methods

void Add(String[] paths)

Adds untracked files or directories to the index and writes the index to the disk (like "git add"). For tracked files that were modified, it stages the modification. Is a no-op for tracked files that were not modified. Note: Add as many files as possible by one call of this method for best performance.
Parameters
String[] paths

Paths to add to the index

void AddContent(Byte[] encoded_relative_filepath, Byte[] encoded_content)

Add content to the index directly without the need for a file in the working directory.
Parameters
Byte[] encoded_relative_filepath

encoded file path (relative to working directory)

Byte[] encoded_content

encoded content

void AddContent(string path, string content)

Add a file to index (without relying on the working directory) by specifying the file's content as string. The added file doesn't need to exist in the working directory.
Parameters
string path

Relative path in the working directory. Note: the path is encoded using PathEncoding

string content

The content as string. Note: the content is encoded using ContentEncoding

Commit CommitChanges(string message, Author author)

void Delete(String[] paths)

Removes files or directories from the index and delete them from the working directory.

string GetContent(string path)

void Read()

Reads the index from the disk

void Remove(String[] paths)

Removes files or directories from the index which are no longer to be tracked. Does not delete files from the working directory. Use Delete to remove and delete files. Note: Remove requires the files and directories to be removed to be present in the working directory in order to find out. TODO: make this not dependent of the working directory by looking into the tree of the current commit.

void Stage(String[] paths)

Stages the given files. Untracked files are added. This is an alias for Add.

void StageContent(string path, string content)

This is an alias for AddContent.

void Unstage(String[] paths)

Unstage overwrites staged files in the index with their current version in HEAD. This has no effect for added files as they are not present in HEAD. See Remove for that.
Parameters
String[] paths

Relative paths to files you want to unstage.

void Write()

Writes the index to the disk.

Public properties

Encoding ContentEncoding get; set;

The encoding to be used to convert file contents from string to byte arrays.

IEnumerable<string> Entries get;

bool IsChanged get;

Returns true if the index has been changed, which means there are changes to be committed. This is not to be confused with the status of the working directory. If changes in the working directory have not been staged then IsChanged is false.

Blob Item get; set;

Encoding PathEncoding get; set;

The encoding to be used to convert file paths from string to byte arrays.

RepositoryStatus Status get;