Documentation
¶
Index ¶
- func Add() error
- func AddRemote(repoDir, remoteName, url string) error
- func Clone(url, targetDir string) error
- func Commit(message string) error
- func GetCurrentGithubUser() (string, error)
- func GetRemoteURL() (string, error)
- func GetRemoteURLFromDir(dir string) (string, error)
- func GetRepoRoot() (string, error)
- func HasUncommittedChanges() (bool, error)
- func InitRepository(dir string) error
- func IsBehindRemote() (bool, int, error)
- func IsGitRepository() bool
- func IsGitRepositoryDir(dir string) bool
- func Pull(repoDir string) error
- func Push(repoDir string) error
- func PushToMain() error
- func RemoveRemote(repoDir, remoteName string) error
- func SetRemoteURL(dir, remoteName, url string) error
- type RemoteInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentGithubUser ¶ added in v0.2.11
GetCurrentGithubUser attempts to retrieve the GitHub username of the current user by checking SSH authentication and git configuration.
func GetRemoteURL ¶
GetRemoteURL retrieves the git remote URL from the current directory
func GetRemoteURLFromDir ¶ added in v0.1.1
GetRemoteURLFromDir retrieves the git remote URL from the specified directory. If dir is empty, it uses the current directory.
func GetRepoRoot ¶
GetRepoRoot returns the root directory of the git repository
func HasUncommittedChanges ¶ added in v0.1.2
HasUncommittedChanges checks if there are uncommitted changes in the repository
func InitRepository ¶ added in v0.2.33
InitRepository initializes a new git repository in the specified directory. If dir is empty, it uses the current directory.
func IsBehindRemote ¶ added in v0.2.40
IsBehindRemote checks if the local branch is behind origin/main. Returns whether it's behind, how many commits behind, and any error. Uses a 5-second timeout to avoid blocking if the network is unavailable.
func IsGitRepository ¶ added in v0.1.2
func IsGitRepository() bool
IsGitRepository checks if the current directory is a git repository
func IsGitRepositoryDir ¶ added in v0.2.33
IsGitRepositoryDir checks if the specified directory is a git repository. If dir is empty, it uses the current directory.
func PushToMain ¶ added in v0.1.2
func PushToMain() error
PushToMain pushes commits to the remote repository on main branch
func RemoveRemote ¶
RemoveRemote removes a git remote
func SetRemoteURL ¶ added in v0.2.33
SetRemoteURL sets or updates the origin remote URL. If the remote doesn't exist, it adds it. If it exists, it updates it.
Types ¶
type RemoteInfo ¶
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