gitinfo

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package gitinfo reads minimal git metadata from the working tree without shelling out — only the files needed to identify the current branch.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentBranch

func CurrentBranch(cwd string) string

CurrentBranch returns the branch name at HEAD for the given working directory. Returns an empty string when:

  • cwd is empty or not inside a git repository
  • HEAD is detached (no symbolic ref)
  • any required file is unreadable

Supports both regular repos (.git is a directory) and linked worktrees (.git is a file pointing to gitdir).

Types

This section is empty.

Jump to

Keyboard shortcuts

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