git

package
v0.0.0-...-5b3f85d Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package git provides repository lifecycle management commands.

This package implements the `gz git repo` command structure, providing comprehensive repository management capabilities across multiple Git platforms including GitHub, GitLab, and Gitea.

The package includes subcommands for:

  • clone: Advanced repository cloning with parallel execution
  • list: Repository listing with filtering and formatting
  • create: Repository creation with templates and settings
  • delete: Safe repository deletion with backups
  • archive: Repository archival management
  • sync: Cross-platform repository synchronization
  • migrate: Repository migration between platforms
  • search: Advanced repository search capabilities

Usage:

gz git repo clone --provider github --org myorg --target ./repos
gz git repo list --provider gitlab --org mygroup --format json
gz git repo create --provider github --org myorg --name newrepo --private

The package integrates with existing synclone functionality for enhanced cloning capabilities and provides a unified interface for repository lifecycle management across different Git hosting platforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEventCmd

func NewEventCmd() *cobra.Command

NewEventCmd creates a new event command.

func NewGitRepoCmd

func NewGitRepoCmd() *cobra.Command

NewGitRepoCmd creates the unified repository lifecycle management command.

func NewWebhookCmd

func NewWebhookCmd() *cobra.Command

NewWebhookCmd creates the webhook management command.

Types

type ArchiveOptions

type ArchiveOptions struct {
	// Provider and target
	Provider string
	Repos    []string
	Org      string

	// Pattern matching
	Match string

	// Operation mode
	Unarchive bool

	// Safety options
	DryRun bool
	Force  bool

	// Output options
	Format string
	Quiet  bool
}

ArchiveOptions contains options for repository archiving.

func (*ArchiveOptions) Validate

func (opts *ArchiveOptions) Validate() error

Validate validates the archive options.

type CloneOrUpdateStrategy

type CloneOrUpdateStrategy string

CloneOrUpdateStrategy defines the strategy to use when a repository already exists

const (
	// StrategyRebase rebases local changes on top of remote changes
	StrategyRebase CloneOrUpdateStrategy = "rebase"
	// StrategyReset performs a hard reset to match remote state (discards local changes)
	StrategyReset CloneOrUpdateStrategy = "reset"
	// StrategyClone removes existing directory and performs fresh clone
	StrategyClone CloneOrUpdateStrategy = "clone"
	// StrategySkip leaves the existing repository unchanged
	StrategySkip CloneOrUpdateStrategy = "skip"
	// StrategyPull performs a standard git pull (merge remote changes)
	StrategyPull CloneOrUpdateStrategy = "pull"
	// StrategyFetch only fetches remote changes without updating working directory
	StrategyFetch CloneOrUpdateStrategy = "fetch"
)

type CreateOptions

type CreateOptions struct {
	// Required fields
	Provider string
	Org      string
	Name     string

	// Repository settings
	Description string
	Private     bool
	Template    string

	// Initialization options
	AutoInit          bool
	GitignoreTemplate string
	License           string
	DefaultBranch     string

	// Features
	Issues   bool
	Wiki     bool
	Projects bool

	// Advanced settings
	Homepage         string
	Topics           []string
	AllowMergeCommit bool
	AllowSquashMerge bool
	AllowRebaseMerge bool

	// Output options
	Format string
	Quiet  bool
}

CreateOptions contains options for repository creation.

func (*CreateOptions) Validate

func (opts *CreateOptions) Validate() error

Validate validates the create options.

type DeleteOptions

type DeleteOptions struct {
	// Provider and target
	Provider string
	Repos    []string
	Org      string

	// Pattern matching
	Match string

	// Safety options
	Force  bool
	DryRun bool
	Backup bool

	// Output options
	Format string
	Quiet  bool
}

DeleteOptions contains options for repository deletion.

func (*DeleteOptions) Validate

func (opts *DeleteOptions) Validate() error

Validate validates the delete options.

type ListOptions

type ListOptions struct {
	// Provider options
	Provider     string
	AllProviders bool
	Org          string

	// Filtering options
	Visibility   string
	ArchivedOnly bool
	NoArchived   bool
	Match        string
	Language     string
	MinStars     int
	MaxStars     int
	UpdatedSince string

	// Sorting options
	Sort  string
	Order string

	// Output options
	Format  string
	Limit   int
	Quiet   bool
	Verbose bool
}

ListOptions contains options for repository listing.

func (*ListOptions) Validate

func (opts *ListOptions) Validate() error

Validate validates the list options.

Jump to

Keyboard shortcuts

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