git

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRemote

func AddRemote(repoDir, remoteName, url string) error

AddRemote adds a git remote

func Clone

func Clone(url, targetDir string) error

Clone clones a git repository

func GetRemoteURL

func GetRemoteURL() (string, error)

GetRemoteURL retrieves the git remote URL from the current directory

func GetRemoteURLFromDir added in v0.1.1

func GetRemoteURLFromDir(dir string) (string, error)

GetRemoteURLFromDir retrieves the git remote URL from the specified directory. If dir is empty, it uses the current directory.

func GetRepoRoot

func GetRepoRoot() (string, error)

GetRepoRoot returns the root directory of the git repository

func Push

func Push(repoDir string) error

Push pushes to the remote repository

func RemoveRemote

func RemoveRemote(repoDir, remoteName string) error

RemoveRemote removes a git remote

Types

type RemoteInfo

type RemoteInfo struct {
	Owner string
	Repo  string
}

RemoteInfo contains parsed information from a git remote URL

func ParseRemoteURL

func ParseRemoteURL(remoteURL string) (*RemoteInfo, error)

ParseRemoteURL parses a git remote URL and extracts the owner and repository name Supports formats: - SSH: git@github.com:owner/repo.git - HTTPS: https://github.com/owner/repo.git - HTTPS (no .git): https://github.com/owner/repo

Jump to

Keyboard shortcuts

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