Documentation
¶
Index ¶
- func Checkout(repoRoot, branch string) error
- func CheckoutNew(repoRoot, name string) error
- func Clean(repoRoot string, includeIgnored bool) error
- func CleanPreview(repoRoot string, includeIgnored bool) ([]string, error)
- func Commit(repoRoot, message string) error
- func CurrentBranch(repoRoot string) (string, error)
- func DiffHEAD(repoRoot, path string) (string, error)
- func FilesInLastCommit(repoRoot string) ([]string, error)
- func LastCommitSummary(repoRoot string) (string, error)
- func ListBranches(repoRoot string) ([]string, string, error)
- func Pull(repoRoot string) error
- func PullWithOutput(repoRoot string) (string, error)
- func Push(repoRoot string) error
- func RepoRoot(path string) (string, error)
- func ResetAndClean(repoRoot string, doReset, doClean, includeIgnored bool) error
- func ResetHard(repoRoot string) error
- func StageFiles(repoRoot string, paths []string) error
- func UncommitFiles(repoRoot string, paths []string) error
- type FileChange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckoutNew ¶
CheckoutNew creates and switches to a new branch: `git checkout -b <name>`.
func CleanPreview ¶
CleanPreview runs a dry-run of git clean and returns the lines that would be removed.
func CurrentBranch ¶
CurrentBranch returns the current branch name (or "HEAD" if detached).
func DiffHEAD ¶
DiffHEAD returns a unified diff between HEAD and the working tree for a single file.
func FilesInLastCommit ¶
FilesInLastCommit lists file paths modified in the last commit (HEAD) compared to its first parent.
func LastCommitSummary ¶
LastCommitSummary returns short hash and subject of last commit.
func ListBranches ¶
ListBranches returns local branch names and the current branch name.
func PullWithOutput ¶
PullWithOutput runs `git pull` and returns the raw CLI output.
func Push ¶
Push attempts to push the current branch. If no upstream is set, it falls back to pushing to the first remote (or origin) with -u.
func ResetAndClean ¶
ResetAndClean executes reset and/or clean in order.
func StageFiles ¶
StageFiles stages the provided file paths.
func UncommitFiles ¶
UncommitFiles removes the selected paths from the last commit by resetting their index state to HEAD^ and amending the commit. Working tree is left untouched so changes reappear as unstaged modifications.
Types ¶
type FileChange ¶
type FileChange struct {
Path string
Staged bool
Unstaged bool
Untracked bool
Binary bool
Deleted bool
}
FileChange represents a changed file in the repo.
func ChangedFiles ¶
func ChangedFiles(repoRoot string) ([]FileChange, error)
ChangedFiles lists files changed relative to HEAD, combining staged, unstaged, and untracked.