Class GitHelper

Helps with a number of Git Operations

System.Object
  MarkdownMonster.Utilities.GitHelper
public class GitHelper : object, IDisposable

Class Members

MemberDescription

Constructor

DefaultStatusesToDisplay

AddRemote

Adds a remote to the current Repository.

public bool AddRemote(string githubUrl,     string remoteName)

Checkout

Checks out a branch on an active repository

public bool Checkout(string branch,     string path)

CloneRepositoryCommandLine

Clones a repository using the Command Line Tooling. Provides built-in authentication UI.

public GitCommandResult CloneRepositoryCommandLine(string gitUrl,     string localPath,     Action<Object,DataReceivedEventArgs> progress,     int depth)

Commit

public bool Commit(ObservableCollection statusItems,     string message,     string name,     string email,     bool ammendPreviousCommit)

CreateBranch

Creates a new branch and optionally checks it out

public bool CreateBranch(string branch,     string path,     bool checkoutBranch)

CreateRepository

Creates a new repository which is the equivalent of a Git Init.

public bool CreateRepository(string path,     string gitIgnoreText)

Dispose

public sealed void Dispose()

ExecuteGitCommand

Executes a Git Command on the command line.

public GitCommandResult ExecuteGitCommand(string arguments,     string path,     int timeoutMs,     ProcessWindowStyle windowStyle,     Action<Object,DataReceivedEventArgs> progress)

FindGitExecutable

Checks to see if Git is installed on the local machine

public static string FindGitExecutable()

FindGitRepositoryRoot

public static string FindGitRepositoryRoot(string folder)

GetActiveRemoteUrl

Retrieves the active repository Remote URL

public string GetActiveRemoteUrl()

GetBranches

Retrieves a listing of Branches

public BranchCollection GetBranches(string path)

GetComittedFileTextContent

Returns the text content for the last commit of a file

public string GetComittedFileTextContent(string path)

GetGitNameAndEmailFromGitConfig

Retrieves Username and Email as a two item array from .gitconfig file if it exists.

public static String[] GetGitNameAndEmailFromGitConfig()

GetGitStatusForFile

Returns the Git file status for an individual file

public FileStatus GetGitStatusForFile(string file)

GetRepositoryChanges

Sets the StatusItems property with all changed items

public ObservableCollection GetRepositoryChanges(string fileOrFolder,     string selectedFile,     bool selectAll,     FileStatus includedStatuses)

GotoGitDownload

Navigates browser to the Git Web download location

public static void GotoGitDownload()

IgnoreFile

Adds an entry to the root .gitignore file if the the value doesn't already exist

public bool IgnoreFile(string filePath)

IsGitInstalled

Determines whether Git is installed

public static bool IsGitInstalled()

Merge

Merges changes from a branch into the current HEAD of the repository

public bool Merge(string path,     string mergeBranch,     string name,     string email)

OpenDiffTool

Opens the configured Diff tool for the provided file and allows comparison.

public bool OpenDiffTool(string filePath)

OpenRepository

Opens a repository and stores it in the Repository property of this class

public Repository OpenRepository(string localPath)

Pull

Pulls changes as a

public bool Pull(string path,     bool rebase,     string branch)

PullAsync

public Task PullAsync(string path,     bool rebase)

Push

Pushes changes to the origin on the remote

public bool Push(string path,     string branch)

PushAsync

public Task PushAsync(string path,     string branch)

UndoChanges

Removes any changes since the last commit on the current active local branch

public void UndoChanges(string file)

CloneProgress

ErrorMessage

Repository

Requirements

Namespace: MarkdownMonster.Utilities
Assembly: markdownmonster.exe

© West Wind Technologies, 2016-2024 • Updated: 11/23/21
Comment or report problem with topic