Skip to content

Repository

Repository is the root type. All operations are performed through an instance or its sub-objects.

MethodDescription
Repository.open(at:)Open existing repository
Repository.initialize(at:bare:)Create new repository
Repository.exists(at:)Check if path is a Git repo
Repository.clone(from:to:credentials:progress:)Clone (async)
PropertyTypeDescription
repo.branchesBranchOperationsBranch management
repo.remotesRemoteOperationsRemote management + fetch/push
repo.tagsTagOperationsTag management
repo.stashStashOperationsStash management
MethodDescription
stage(paths:)Stage specific file paths
stageAll()Stage all changes
unstage(paths:)Unstage specific file paths
commit(message:author:)Create a commit from the index
MethodDescription
status(includeUntracked:)Returns [StatusEntry]
MethodDescription
log(limit:)Most recent commits
log(from:limit:)Commits reachable from a ref
MethodDescription
diff()Working directory vs HEAD
diff(from:)From commit vs its parent
diff(from:to:)Between two commits
MethodDescription
merge(branch:)Merge a branch → MergeResult
rebase(onto:author:)Rebase onto a branch → RebaseResult
abortRebase()Abort an in-progress rebase
cherryPick(_:)Cherry-pick a commit → CherryPickResult
MethodDescription
blame(file:)Returns [BlameHunk]
MethodDescription
worktreeList()List linked worktrees
addWorktree(named:path:branch:)Add a worktree
removeWorktree(named:)Remove a worktree
lockWorktree(named:reason:)Lock a worktree
unlockWorktree(named:)Unlock a worktree