class

Carbon::VCS::Git

Inherits Carbon::VCS::Base < Reference < Object

Constructors

new(root : String | Path = ".")
Source

Class methods

discover(start_path : String | Path = ".") : Git | Nil

Discovers the Git repository root using git rev-parse --show-toplevel

Source

Instance methods

branch_name

The name of the active branch

Source
commit_count

Returns commit count of HEAD. If repository is empty (unborn branch / 0 commits), returns 0.

Source
dirty?

Returns true if working directory has uncommitted or untracked changes

Source
head_hash

The current HEAD commit hash (short or full)

Source
initialized?

Returns true if VCS repository is properly initialized

Source
repo_root

Root directory of the repository

Source
stage(files : Enumerable(String | Path)) : Bool

Stage a set of files into index

Source
vcs_dir

Internal directory storing VCS metadata (e.g. .git)

Source