Expand description
Read-only git operations
Functions§
- behind_
base_ count - How many commits
basehas thatbranchdoes not (branch..base). - behind_
upstream_ count - Get number of commits behind upstream
- branch_
base - Read the recorded base branch for a branch (
branch.<name>.gwBase). - branch_
base_ sha - Read the recorded base tip SHA for a branch (
branch.<name>.gwBaseSha). - 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
- default_
branch_ name - Get the default branch name (e.g. “main” or “master”), without the remote prefix.
- 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_
ancestor - Whether
ancestoris reachable fromdescendant(merge-base --is-ancestor). - 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)
- ref_
exists - Whether a ref (branch, remote-tracking ref, SHA) resolves locally.
- remote_
branch_ exists - Check if a branch exists on remote origin.
- repo_
root - Get the top-level working directory of the repository
- rev_
parse - Resolve a ref to its full commit SHA
- 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)
- worktree_
root - Get the worktree root (the top-level working directory of the current worktree)