git

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package git provides helpers for interacting with local git repositories and configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentBranch added in v0.7.0

func CurrentBranch(ctx context.Context, dir string) (string, error)

CurrentBranch returns the current local branch name.

func GetOrFetchBaseBranch

func GetOrFetchBaseBranch(ctx context.Context, f forges.Forge, dir, owner, repo, branch string, forceRefresh bool) (string, error)

GetOrFetchBaseBranch returns the base branch of the given branch. It first checks the local git configuration for a cached value. If not found, it queries the forge API for an open pull request for the branch, caches the base branch name in the local git configuration, and returns it. If branch is empty, it uses the current branch.

func GetPRNumber added in v0.7.0

func GetPRNumber(ctx context.Context, dir, branch string) (int, error)

GetPRNumber returns the cached pull request number for a branch.

func PushBranch added in v0.10.0

func PushBranch(ctx context.Context, dir, remote, branch string) error

PushBranch pushes a local branch to the same branch name on a remote. It configures upstream tracking only when the remote fetches from and pushes to the same repository, so a fork push URL cannot replace existing tracking for the upstream repository.

func SetBaseBranch

func SetBaseBranch(ctx context.Context, dir, branch, base string) error

SetBaseBranch caches the base branch for a branch in the local git configuration.

func SetPRNumber added in v0.7.0

func SetPRNumber(ctx context.Context, dir, branch string, number int) error

SetPRNumber caches the pull request number for a branch in the local git configuration.

Types

This section is empty.

Jump to

Keyboard shortcuts

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