git

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package git package contains functions to operate git repositories used by git-ghost

Index

Constants

This section is empty.

Variables

View Source
var (
	ORIGIN string = "origin"
)

Functions

func AppendNonIndexedDiffFiles

func AppendNonIndexedDiffFiles(dir, filepath string, nonIndexedFilepaths []string) errors.GitGhostError

AppendNonIndexedDiffFiles appends non-indexed diff files

func ApplyDiffBundleFile

func ApplyDiffBundleFile(dir, filepath string) errors.GitGhostError

ApplyDiffBundleFile apply a patch file created in CreateDiffBundleFile

func ApplyDiffPatchFile

func ApplyDiffPatchFile(dir, filepath string) errors.GitGhostError

ApplyDiffPatchFile apply a diff file created by CreateDiffPatchFile

func CommitAndPush

func CommitAndPush(dir, filename, message, committish string) errors.GitGhostError

CommitAndPush commits and push to its origin

func CommitFile

func CommitFile(dir, filename, message string) errors.GitGhostError

CommitFile commits a file

func CopyUserConfig

func CopyUserConfig(srcDir, dstDir string) errors.GitGhostError

CopyUserConfig copies user config from source directory to destination directory.

func CreateDiffBundleFile

func CreateDiffBundleFile(dir, filepath, fromCommittish, toCommittish string) errors.GitGhostError

CreateDiffBundleFile creates patches for fromCommittish..toCommittish and save it to filepath

func CreateDiffPatchFile

func CreateDiffPatchFile(dir, filepath, committish string) errors.GitGhostError

CreateDiffPatchFile creates a diff from committish to current working state of `dir` and save it to filepath

func CreateOrphanBranch

func CreateOrphanBranch(dir, branch string) errors.GitGhostError

CreateOrphanBranch creates an orphan branch on dir

func DeleteRemoteBranches

func DeleteRemoteBranches(dir string, branchNames ...string) errors.GitGhostError

DeleteRemoteBranches delete branches from its origin

func GetUserConfig

func GetUserConfig(dir string) (string, string, errors.GitGhostError)

GetUserConfig returns a user config (name and email) from destination directory.

func InitializeGitDir

func InitializeGitDir(dir, repo, branch string) errors.GitGhostError

InitializeGitDir clone repo to dir. if you set empty branchname, it will checkout default branch of repo.

func ListRemoteBranchNames

func ListRemoteBranchNames(repo string, branchnames []string) ([]string, errors.GitGhostError)

ListRemoteBranchNames returns remote branch names

func Pull

func Pull(dir, committish string) errors.GitGhostError

Pull pulls committish from its origin

func Push

func Push(dir string, committishes ...string) errors.GitGhostError

Push pushes current HEAD to its origin

func ResetHardToBranch

func ResetHardToBranch(dir, branch string) errors.GitGhostError

ResetHardToBranch reset dir to branch with --hard option

func ResolveCommittish

func ResolveCommittish(dir, committish string) (string, errors.GitGhostError)

ResolveCommittish resolves committish as full commit hash on dir

func SetUserConfig

func SetUserConfig(dir, name, email string) errors.GitGhostError

SetUserConfig sets a user config (name and email) to destination directory.

func ValidateCommittish

func ValidateCommittish(dir, committish string) errors.GitGhostError

ValidateCommittish check committish is valid on dir

func ValidateGit

func ValidateGit() errors.GitGhostError

ValidateGit check the environment has 'git' command or not.

func ValidateRemoteBranchExistence

func ValidateRemoteBranchExistence(repo, branch string) (bool, errors.GitGhostError)

ValidateRemoteBranchExistence checks repo has branch or not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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