Skip to contents

Reads the .git/HEAD file and returns the current branch name, or "DETACHED" if the repository is in detached HEAD state.

Usage

get_git_branch(repo_root)

Arguments

repo_root

Character. Path to repository root.

Value

Character. Branch name, "DETACHED", or NA if not available.

Examples

if (FALSE) { # \dontrun{
get_git_branch("/path/to/repo")
} # }