Skip to main content

Module query

Module query 

Source
Expand description

Read-only git operations

Functions§

behind_upstream_count
Get number of commits behind upstream
branch_exists
Check if a branch exists locally
commit_count
Count commits between two refs (exclusive..inclusive)
current_branch
Get the current branch name
current_dir_name
Get the current working directory name
get_default_remote_branch
Get the default remote branch (origin/main or origin/master)
get_latest_stash_message
Get the message of the latest stash (stash@{0})
get_upstream
Get the upstream tracking branch for a local branch, if any
git_common_dir
Get the common git directory (always .git of main repo)
git_dir
Get the git directory (.git or .git/worktrees/xxx)
has_commits_to_undo
Check if HEAD has a parent commit (i.e., we can undo)
has_remote_tracking
Check if a branch has a remote tracking branch
has_staged_changes
Check if working directory has staged changes
has_uncommitted_changes
Check if working directory has any uncommitted changes (staged or unstaged)
has_unstaged_changes
Check if working directory has unstaged changes
has_untracked_files
Check if working directory has untracked files
head_commit
Get the current HEAD commit hash
head_commit_message
Get the commit message of HEAD
is_detached_head
Check if HEAD is detached
is_git_repo
Check if we’re in a git repository
is_worktree
Check if we’re in a worktree (not the main repo)
remote_branch_exists
Check if a branch exists on remote origin
short_commit
Get the short commit hash
stash_count
Count stashes
unpushed_commit_count
Get number of unpushed commits on a branch (compared to its upstream)