Skip to contents

Determines the base Git tree URL to the current branch's upstream remote of repo.

Usage

git_remote_tree_url(repo = ".", remote = NULL)

Arguments

repo

The path to the git repository. If the directory is not a repository, parent directories are considered (see git_find). To disable this search, provide the filepath protected with I(). When using this parameter, always explicitly call by name (i.e. repo = ) because future versions of gert may have additional parameters.

remote

Name of the Git remote to determine the URL for. Defaults to "origin" if present, otherwise the first remote listed by gert::git_remote_list().

Value

If repo is a Git repository, a character scalar. Otherwise, a character vector of length zero.

Details

This function is useful to assemble URLs to files and folders in your repo's Git forge (GitHub, GitLab, etc.).

See also

Other Git functions: git_file_mod_time()

Examples

pal::git_remote_tree_url() |>
  paste0("Rmd/pal.Rmd") |>
  browseURL()