git

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallHook added in v0.2.0

func InstallHook() error

InstallHook installs the commit-msg hook in the current git repository

Example usage:

if err := git.InstallHook(); err != nil {
   fmt.Printf("Error installing hook: %v\n", err)
 return
}

Prints a success message if the hook is installed successfully

Types

type Commit

type Commit struct {
	Hash    string
	Message string
}

func GetCommits

func GetCommits(commitRange string) ([]Commit, error)

GetCommits returns a list of commits from a commit range

The function accepts a Git commit range (e.g., "HEAD~5..HEAD") and returns a list of commits in the range.

Example usage:

commits, err := git.GetCommits("HEAD~5..HEAD")

if err != nil {
   fmt.Printf("Error getting commits: %v\n", err)
  return
}

Returns a list of commits or an error if the command fails

Jump to

Keyboard shortcuts

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