gitops

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gitops provides Git operations via subprocess.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitAndPush

func CommitAndPush(files []string, message, branch string) (string, error)

CommitAndPush stages files, commits, and force-pushes to origin. The branch always represents HEAD + the YAML changes, so force push is the default.

func Configure

func Configure(userName, userEmail, token, repository, serverURL string) error

Configure sets up git with user info and authentication.

func GetDefaultBranch

func GetDefaultBranch() string

GetDefaultBranch returns the default branch name.

func PrepareWorktree added in v0.3.8

func PrepareWorktree(branch, base string) error

PrepareWorktree fetches origin/<base> and resets the working tree to a fresh <branch> based on it.

It must run BEFORE any YAML edits: at that point the working tree is clean, so switching away from whatever ref the caller checked out (e.g. a release tag on a diverged hotfix branch) never hits "local changes would be overwritten". Editing afterwards then makes the changes — and the resulting commit/PR — relative to origin/<base>, independent of the caller's checkout. When <branch> equals <base>, this simply checks out the up-to-date base for a direct commit.

Types

This section is empty.

Jump to

Keyboard shortcuts

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