Cake.Git

Cake AddIn that extends Cake with Git aliases using LibGit2 and LibGit2Sharp.

#addin nuget:?package=Cake.Git&version=1.1.0

<package id="Cake.Git" version="1.1.0" />

dotnet add package Cake.Git --version 1.1.0

<PackageReference Include="Cake.Git" Version="1.1.0" />

Aliases

Class GitAliases. Contains functionality for working with GIT using LibGit2 & LibGit2Sharp

Add

GitAdd(DirectoryPath, FilePath[]) Add file to index.
GitAddAll(DirectoryPath) Add all file changes to index.

Branch

Branches

GitBranchCurrent(DirectoryPath) Gets the current branch.
GitBranches(DirectoryPath) Gets a list of all branches from the repository.

Checkout

GitCheckout(DirectoryPath, FilePath[]) Checkout file.
GitCheckout(DirectoryPath, string, FilePath[]) Checkout file(s) using supplied commit or branch spec.

Clean

GitClean(DirectoryPath) Remove untracked file(s) workspace.

Clone

GitClone(string, DirectoryPath) Clone unauthenticated using default options.
GitClone(string, DirectoryPath, GitCloneSettings) Clone unauthenticated using specific settings.
GitClone(string, DirectoryPath, string, string) Clone authenticated using default options.
GitClone(string, DirectoryPath, string, string, GitCloneSettings) Clone authenticated using specific settings.

Commit

GitCommit(DirectoryPath, string, string, string) Commit using default options.

Configuration

GitConfigExists<T>(DirectoryPath, string) Returns whether a configuration value exists with the specifed key.
GitConfigGet<T>(DirectoryPath, string) Gets the specified configuration value.
GitConfigGet<T>(DirectoryPath, string, T) Gets the specified configuration value. If the specified value is not found it will return the specified default value.
GitConfigSetLocal<T>(DirectoryPath, string, T) Gets the specified configuration value. If the specified value is not found it will return the specified default value.
GitConfigUnsetLocal(DirectoryPath, string) Unsets the specified local configuration key.

Describe

Diff

GitDiff(DirectoryPath) Get changed files from inital commit id up to current.
GitDiff(DirectoryPath, string) Get changed files from certain commit id up to current.
GitDiff(DirectoryPath, string, string) Get changed files from certain commit id up to current.

Init

GitInit(DirectoryPath) Init using default options.

Log

GitLog(DirectoryPath, int) Get commit log.
GitLog(DirectoryPath, string) Get commit from certain commit id up to current.
GitLogLookup(DirectoryPath, string) Get specific commit.
GitLogTag(DirectoryPath, string) Get commits after a certain tag
GitLogTip(DirectoryPath) Get last commit

Pull

GitPull(DirectoryPath, string, string) Pull unauthenticated using default options.
GitPull(DirectoryPath, string, string, string, string, string) Pull authenticating using default options.

Push

GitPush(DirectoryPath) Push all branches unauthenticated.
GitPush(DirectoryPath, string, string) Push all branches authenticated.
GitPush(DirectoryPath, string, string, string) Push specific branch authenticated.
GitPushRef(DirectoryPath, string, string) Push a tag to a remote unauthenticated.
GitPushRef(DirectoryPath, string, string, string, string) Push a tag to a remote authenticated.

Remove

GitRemove(DirectoryPath, bool, FilePath[]) Remove file(s) from index.

Repository

GitFindRootFromPath(DirectoryPath) Finding git root path from subtree.
GitHasStagedChanges(DirectoryPath) Checks if a repository contains staged changes.
GitHasUncommitedChanges(DirectoryPath) Checks if a repository contains uncommited changes.
GitHasUntrackedFiles(DirectoryPath) Checks if a repository contains untracked files.
GitIsValidRepository(DirectoryPath) Checks if a specific directory is a valid Git repository.

Reset

GitReset(DirectoryPath, GitResetMode) Resets the current branch head (HEAD) optionally modifying index and working tree to match.
GitReset(DirectoryPath, GitResetMode, string) Sets the current branch head (HEAD) to a specified commit, optionally modifying index and working tree to match.

Tag

GitTag(DirectoryPath, string) Applys tagName to repository.
GitTag(DirectoryPath, string, string) Applys tagName to repository.
GitTag(DirectoryPath, string, string, string, string) Applys tagName to repository as annotated tag.
GitTag(DirectoryPath, string, string, string, string, string) Applys tagName to repository as annotated tag.

Tags

GitTags(DirectoryPath) Gets a list of all tags from the repository.
GitTags(DirectoryPath, bool) Gets a list of all tags from the repository with the option to load targets of the tags.

Unstage

GitUnstage(DirectoryPath, FilePath[]) Removes from the staging area all the modifications of a collection of file since the latest commit (addition, updation or removal).
GitUnstageAll(DirectoryPath) Removes from the staging area all the modifications all files the latest commit (addition, updation or removal).