git

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHeadSHA

func GetHeadSHA(cwd string) (string, error)

GetHeadSHA returns the full SHA of the HEAD commit Returns empty string and error if not a git repo or no commits

func GetRepoURL

func GetRepoURL(cwd string) (string, error)

GetRepoURL returns the remote origin URL for a git repository Returns empty string if not a git repo or no remote configured

func ToGitHubURL

func ToGitHubURL(gitURL string) string

ToGitHubURL converts a git remote URL to a GitHub HTTPS URL. Handles: git@github.com:owner/repo.git, https://github.com/owner/repo.git, ssh://git@github.com/owner/repo.git Returns empty string if not a GitHub URL.

Types

type GitInfo

type GitInfo struct {
	RepoURL       string `json:"repo_url,omitempty"`
	Branch        string `json:"branch,omitempty"`
	CommitSHA     string `json:"commit_sha,omitempty"`
	CommitMessage string `json:"commit_message,omitempty"`
	Author        string `json:"author,omitempty"`
	IsDirty       bool   `json:"is_dirty"`
}

GitInfo contains git repository information

func DetectGitInfo

func DetectGitInfo(cwd string) (*GitInfo, error)

DetectGitInfo detects git information from the given directory Returns nil if not in a git repository (this is not an error)

func ExtractGitInfoFromTranscript

func ExtractGitInfoFromTranscript(transcriptPath string) (*GitInfo, error)

ExtractGitInfoFromTranscript parses a Claude Code transcript file to extract git information This is useful for uploading sessions where the original directory may not exist

Jump to

Keyboard shortcuts

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