GitLocalRepository class

A repository on disk as a person keeps it: a working repository (its .git folder, or a linked worktree's .git file), or a bare one.

repository reads and writes objects and branches in git's own layout, so git sees every commit this library makes and this library sees git's. What it never touches is a working tree or the index — which is why checkedOutBranches exists: a commit moved onto a branch some working tree has checked out leaves that tree and its index describing the commit before, and git status then shows the new commit as a change to undo. git refuses a push to such a branch for the same reason (receive.denyCurrentBranch).

HEAD is read whenever it is asked about, never cached: the person may check out another branch while the repository is open.

Constructors

GitLocalRepository.open(String folder)
Opens the repository folder names: a folder holding .git (a folder, or a file reading gitdir: <path>), a bare repository, or a .git folder itself. Throws GitNotARepositoryException for anything else.
factory

Properties

commonDir → String
Where objects and branches live — gitDir, or for a linked worktree the main repository's git directory its commondir names.
final
folder → String
The folder that was opened.
final
gitDir → String
The git directory: .git, a linked worktree's directory, or the bare repository itself. Holds this repository's HEAD.
final
hashCode → int
The hash code for this object.
no setterinherited
isBare → bool
Whether no working tree belongs to gitDir.
final
repository → GitRepository
Objects and refs, over commonDir.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkedOutBranches() → Set<String>
Every branch some working tree of this repository has checked out: the main working tree's (unless the repository is bare) and each linked worktree's.
headBranch() → String?
The branch HEAD names, or null when it is detached. For a bare repository this is its default branch; for a working one, the branch checked out.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited