gzhcligitforge

package module
v0.0.0-...-9acccbf Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 2 Imported by: 0

README

gzh-cli-gitforge

Bulk-first Git operations CLI (gz-git) + Go library

Go Version Version CI License GoDoc

gzh-cli-gitforge provides:

  • gz-git (CLI): scan directories and run safe Git operations across many repositories in parallel.
  • Go library: reusable packages under pkg/ for repository operations, bulk workflows, and forge sync.

CLI Highlights (gz-git)

  • Bulk operations with --scan-depth and --parallel: status, fetch, pull, push, update, diff, commit, switch
  • Bulk clone: clone --url ... / clone --file ... (+ --update)
  • Git forge operations:
    • forge from (GitHub/GitLab/Gitea org/group/user)
    • forge config generate → then workspace sync (YAML config workflow)
  • Maintenance: cleanup branch (dry-run by default)
  • Monitoring: watch (default/compact/json/llm)
  • Insights: history (stats/contributors/file/blame), info, conflict detect
  • Tag/stash helpers: tag, stash

Quick Start

Install
go install github.com/gizzahub/gzh-cli-gitforge/cmd/gz-git@latest
gz-git --version
Common Workflows
# Bulk status (current directory + 1 level)
gz-git status

# Fetch everything under ~/projects (2 levels deep)
gz-git fetch -d 2 ~/projects

# Update repos (pull --rebase), continuously
gz-git update --watch --interval 5m -d 2 ~/projects

# Bulk commit (preview → apply)
gz-git commit -d 2 ~/projects
gz-git commit --yes -d 2 ~/projects

# Switch branch across repos (create if missing)
gz-git switch feature/foo --create -d 2 ~/projects

# Bulk clone into ~/projects
gz-git clone ~/projects --url https://github.com/user/repo1.git --url https://github.com/user/repo2.git

# Sync all repos from a GitHub org
gz-git forge from --provider github --org myorg --path ./repos --token $GITHUB_TOKEN

# Filter repos by language, stars, activity (NEW)
gz-git forge from --provider github --org kubernetes --path ./k8s \
  --language go --min-stars 100 --last-push-within 30d

# Workspace sync with detailed preview (NEW: shows file changes, conflicts)
gz-git workspace sync  # Preview then auto-proceed
gz-git workspace sync --dry-run  # Preview only
gz-git workspace sync --interactive  # Ask before executing
gz-git workspace sync --format json  # Machine-readable output

Requirements

  • Git 2.30+
  • Go 1.25.1+ (building from source / using as a library)

Documentation


License

MIT. See LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is the current library version following semantic versioning.
	// Format: vMAJOR.MINOR.PATCH[-PRERELEASE].
	Version = "0.6.1"

	// GitCommit is the git commit SHA of the build.
	// This is set during the build process.
	GitCommit = "unknown"

	// BuildDate is the date when the binary was built.
	// This is set during the build process.
	BuildDate = "unknown"
)

Version information. These values can be overridden at build time using -ldflags.

Example:

go build -ldflags "-X github.com/gizzahub/gzh-cli-gitforge.GitCommit=$(git rev-parse HEAD)"

Functions

func FullVersion

func FullVersion() string

FullVersion returns the version with 'v' prefix.

Example:

fmt.Println(gzhcligitforge.FullVersion())
// Output: v0.1.0-alpha

func ShortVersion

func ShortVersion() string

ShortVersion returns just the version number without prefix.

Example:

fmt.Println(gzhcligitforge.ShortVersion())
// Output: 0.1.0-alpha

func VersionInfo

func VersionInfo() map[string]string

VersionInfo returns detailed version information as a map.

The returned map contains:

  • version: The library version (e.g., "0.1.0-alpha")
  • gitCommit: The git commit SHA (e.g., "a1b2c3d")
  • buildDate: The build date (e.g., "2025-11-30")
  • goVersion: The Go version used for building (e.g., "go1.24.0")

Example:

info := gzhcligitforge.VersionInfo()
fmt.Printf("Version: %s\n", info["version"])
fmt.Printf("Commit: %s\n", info["gitCommit"])

func VersionString

func VersionString() string

VersionString returns a formatted version string.

Format: "gzh-cli-gitforge version v0.1.0-alpha (commit: a1b2c3d, built: 2025-11-30)"

Example:

fmt.Println(gzhcligitforge.VersionString())
// Output: gzh-cli-gitforge version v0.1.0-alpha (commit: unknown, built: unknown)

Types

This section is empty.

Directories

Path Synopsis
cmd
gz-git command
Package main is the entry point for the gz-git CLI application.
Package main is the entry point for the gz-git CLI application.
gz-git/cmd
Package cmd implements the CLI commands for gz-git.
Package cmd implements the CLI commands for gz-git.
examples
basic command
branch command
clone command
history command
merge command
internal
gitcmd
Package gitcmd provides Git command execution and output handling.
Package gitcmd provides Git command execution and output handling.
testutil/builders
Package builders provides fluent test fixture builders for git operations.
Package builders provides fluent test fixture builders for git operations.
pkg
branch
Package branch provides git branch management operations.
Package branch provides git branch management operations.
cliutil
Package cliutil provides CLI utility functions and formatters.
Package cliutil provides CLI utility functions and formatters.
config
Package config provides configuration management for gz-git CLI.
Package config provides configuration management for gz-git CLI.
gitea
Package gitea implements the provider interface for Gitea.
Package gitea implements the provider interface for Gitea.
github
Package github implements the provider interface for GitHub.
Package github implements the provider interface for GitHub.
gitlab
Package gitlab implements the provider interface for GitLab.
Package gitlab implements the provider interface for GitLab.
history
Package history provides git history analysis and contributor statistics.
Package history provides git history analysis and contributor statistics.
hooks
Package hooks provides secure command execution for before/after hooks.
Package hooks provides secure command execution for before/after hooks.
merge
Package merge provides merge conflict detection and analysis.
Package merge provides merge conflict detection and analysis.
provider
Package provider defines the interface for Git forge providers.
Package provider defines the interface for Git forge providers.
ratelimit
Package ratelimit provides rate limiting functionality for API calls.
Package ratelimit provides rate limiting functionality for API calls.
repository
Package repository provides git repository abstraction and bulk operations.
Package repository provides git repository abstraction and bulk operations.
scanner
Package scanner provides local git repository discovery and scanning.
Package scanner provides local git repository discovery and scanning.
stash
Package stash provides git stash management operations.
Package stash provides git stash management operations.
tag
Package tag provides git tag management and semantic versioning.
Package tag provides git tag management and semantic versioning.
templates
Package templates provides configuration file template generation.
Package templates provides configuration file template generation.
tui
Package tui provides terminal UI components for interactive displays.
Package tui provides terminal UI components for interactive displays.
watch
Package watch provides repository monitoring and change detection.
Package watch provides repository monitoring and change detection.
wizard
Package wizard provides interactive setup wizards for gz-git commands.
Package wizard provides interactive setup wizards for gz-git commands.
workspacecli
Package workspacecli provides CLI commands for managing local workspaces with config-based repository synchronization.
Package workspacecli provides CLI commands for managing local workspaces with config-based repository synchronization.

Jump to

Keyboard shortcuts

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