git_remote_tree_url: Get Git remote tree URL

git_remote_tree_urlR Documentation

Get Git remote tree URL

Description

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().

Details

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

Value

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

See Also

Other Git functions: git_file_mod_time()

Examples

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

salim-b/pal documentation built on Feb. 28, 2025, 6:51 p.m.