Documentation ¶
Index ¶
- type Git
- func (git *Git) AddAlias(alias, command string) error
- func (git *Git) Checkout(branch string) error
- func (git *Git) Cherry() ([]string, error)
- func (git *Git) CurrentBranch() (string, error)
- func (git *Git) Exec(arg ...string) (string, error)
- func (git *Git) Exec2(arg ...string) (Output, error)
- func (git *Git) ExecSilent(arg ...string) error
- func (git *Git) FindMainBranch() (string, error)
- func (git *Git) ListBranches() ([]string, error)
- func (git *Git) Rebase(base, target string) error
- type Output
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
WorkingDir string
}
func (*Git) AddAlias ¶
AddAlias adds a global alias to git config `git config --global alias.<alias> 'command'
func (*Git) CurrentBranch ¶
CurrentBranch returns the name of the current checked out branch `git branch --show-current`
func (*Git) ExecSilent ¶
ExecSilent runs a git command with the passed args and ignores the output
func (*Git) FindMainBranch ¶
FindMainBranch returns the name of the main branch
right now it only looks if either `main` or `master` exist I can later add more generic code to figure out the default branch if it was neither `master` nor `main`
func (*Git) ListBranches ¶
ListBranches returns the names of local branches `git branch --format=%(refname:short)`
type Output ¶
func Exec ¶
Exec executes a git command within a working directory wd It returns both stdout, and stderr along with an error type Note that git sometimes uses stderr even though process exits with 0