git

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitClient

type GitClient struct {
	// contains filtered or unexported fields
}

GitClient 封装 Git 操作

func NewGitClient

func NewGitClient(workDir string) *GitClient

NewGitClient 创建一个新的 GitClient

func (*GitClient) CreateAnnotatedTag

func (g *GitClient) CreateAnnotatedTag(version, message string) error

CreateAnnotatedTag 创建 annotated tag

func (*GitClient) CreateTag

func (g *GitClient) CreateTag(version string) error

CreateTag 创建 lightweight tag

func (*GitClient) GetAllTags

func (g *GitClient) GetAllTags() ([]string, error)

GetAllTags 获取所有 tags

func (*GitClient) GetRemoteName

func (g *GitClient) GetRemoteName() (string, error)

GetRemoteName 获取远程仓库名称(优先返回 origin)

func (*GitClient) GetRemoteURL added in v0.1.0

func (g *GitClient) GetRemoteURL() (string, error)

GetRemoteURL 获取远程仓库的 URL

func (*GitClient) GetTagsWithDates

func (g *GitClient) GetTagsWithDates() ([]TagInfo, error)

GetTagsWithDates 获取所有 tags 及其创建日期

func (*GitClient) HasRemote

func (g *GitClient) HasRemote() (bool, error)

HasRemote 检查是否配置了远程仓库

func (*GitClient) HasUncommittedChanges

func (g *GitClient) HasUncommittedChanges() (bool, error)

HasUncommittedChanges 检查是否有未提交的修改

func (*GitClient) IsGitRepository

func (g *GitClient) IsGitRepository() (bool, error)

IsGitRepository 检查当前目录是否在 git 仓库中

func (*GitClient) PushTag

func (g *GitClient) PushTag(version string) error

PushTag 推送 tag 到远程仓库

func (*GitClient) TagExists

func (g *GitClient) TagExists(tag string) (bool, error)

TagExists 检查指定的 tag 是否存在

type TagInfo

type TagInfo struct {
	Name string
	Date time.Time
}

TagInfo 包含 tag 的信息

Jump to

Keyboard shortcuts

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