git

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBranchDoesNotExist = errors.New("Cannot checkout branch as it doesn't exist")

ErrBranchDoesNotExist is an error for when the branch asked to be checked out, doesn't exist

View Source
var ErrNoCurrentBranchFound = errors.New("no current branch found")

ErrNoCurrentBranchFound is an error returned when the input branches doesn't contain a current branch indicator

Functions

func Add

func Add(commander run.ICommander) (string, error)

Add will run git status and return the result

func CheckoutBranch

func CheckoutBranch(commander run.ICommander) (string, error)

CheckoutBranch checks out a branch

func CommitChanges

func CommitChanges(commander run.ICommander) (string, error)

CommitChanges will run git commit

func DeleteBranch

func DeleteBranch(commander run.ICommander) (string, error)

DeleteBranch will run git delete for a branch

func GetBranches

func GetBranches(commander run.ICommander) ([]string, error)

GetBranches gets all local branches

func GetCurrentBranch

func GetCurrentBranch(branches []string) (string, error)

GetCurrentBranch takes a slice of branch names and returns the current branch based on which one starts with an *

func GetFilesOrNothingToCommit

func GetFilesOrNothingToCommit(s string) ([]string, bool)

GetFilesOrNothingToCommit will return a slice of files that aren't tracked and if there is nothing to commit, a true flag

func GetFilesToBeCommitted

func GetFilesToBeCommitted(s string) []string

GetFilesToBeCommitted will return a slice of strings from a git status result

func GetNotStagedFiles

func GetNotStagedFiles(s string) []string

GetNotStagedFiles will return a slice of files that are not staged for commit

func Merge

func Merge(commander run.ICommander) (string, error)

Merge will run git merge and return the result

func Push

func Push(commander run.ICommander) (string, error)

Push will run a git push command and return the result

func RemoveCurrentBranch

func RemoveCurrentBranch(branches *[]string)

RemoveCurrentBranch will remove the current branch from a list of branches

func RemoveOriginHead

func RemoveOriginHead(branches *[]string)

RemoveOriginHead will remove a the head branch

func RemoveRemoteOriginFromName

func RemoveRemoteOriginFromName(branch *string)

RemoveRemoteOriginFromName removes the remotes/origin part of the branch

func SplitBranches

func SplitBranches(s string, removeCurrent bool) []string

SplitBranches takes a string of branches with newline separators and splits them into a slice

func Status

func Status(commander run.ICommander) (string, error)

Status will run git status and return the result

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL