Skip to content

Commit 5e6764d

Browse files
committed
docs: document how to detect a "detached head"
1 parent 1ae6833 commit 5e6764d

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

R/repository.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#' * `git_info()` shows basic information about a repository, such as the SHA
66
#' and branch of the current HEAD.
77
#'
8+
#' @section Path:
9+
#'
810
#' For `git_init()` the `path` parameter sets the directory of the git repository
911
#' to create. If this directory already exists, it must be empty. If it does
1012
#' not exist, it is created, along with any intermediate directories that don't
@@ -21,7 +23,7 @@
2123
#' @family git
2224
#' @useDynLib gert R_git_repository_init
2325
#' @inheritParams git_open
24-
#' @param path the location of the git repository, see details.
26+
#' @param path the location of the git repository, see the "path" section.
2527
#' @param bare if true, a Git repository without a working directory is created
2628
#' @git repository
2729
#' @return
@@ -68,6 +70,9 @@ git_find <- function(path = '.') {
6870
#' @export
6971
#' @rdname git_repo
7072
#' @useDynLib gert R_git_repository_info
73+
#' @section Detached head:
74+
#' If `git_info()$shorthand` is equal to `HEAD`,
75+
#' it means the repository is in a [detached head state](https://jvns.ca/blog/2023/11/01/confusing-git-terminology/#detached-head-state).
7176
git_info <- function(repo = '.') {
7277
repo <- git_open(repo)
7378
.Call(R_git_repository_info, repo)

man/git_repo.Rd

Lines changed: 11 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)