Cake.Git

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

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

dotnet add package Cake.Git --version 5.0.1

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

Aliases

Contains functionality for working with GIT using LibGit2 & LibGit2Sharp. NOTE: The addin currently only runs on x64 processors. ARM processors are not supported.

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, GitCloneSettings) Clone unauthenticated using specific settings.
GitClone(string, DirectoryPath, string, string, GitCloneSettings) Clone authenticated using specific settings.
GitClone(string, DirectoryPath, string, string) Clone authenticated using default options.
GitClone(string, DirectoryPath) Clone unauthenticated using default options.

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, T) Gets the specified configuration value. If the specified value is not found it will return the specified default value.
GitConfigGet<T>(DirectoryPath, string) Gets the specified configuration 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, string, string) Get changed files from certain commit id up to current.
GitDiff(DirectoryPath, string) Get changed files from certain commit id up to current.
GitDiff(DirectoryPath) Get changed files from inital commit id up to current.

Fetch

GitFetch(DirectoryPath, GitFetchSettings) Download from another repository.
GitFetch(DirectoryPath, string) Download objects and refs from another repository.
GitFetchTags(DirectoryPath, string) Download tags from another repository.

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, string, string, string) Pull authenticating using default options.
GitPull(DirectoryPath, string, string) Pull unauthenticated using default options.

Push

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

Remotes

GitRemote(DirectoryPath, string) Gets the specified remote from a Git repository.
GitRemotes(DirectoryPath) Gets a Git repository's remotes.

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, string) Sets the current branch head (HEAD) to a specified commit, optionally modifying index and working tree to match.
GitReset(DirectoryPath, GitResetMode) Resets the current branch head (HEAD) optionally modifying index and working tree to match.

Sha

GitShortenSha(DirectoryPath, GitCommit, Nullable<int>) Get the short version of a commit SHA.

Tag

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

Tags

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

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).