Package 'gert'

Title: Simple Git Client for R
Description: Simple git client for R based on 'libgit2' <https://libgit2.org> with support for SSH and HTTPS remotes. All functions in 'gert' use basic R data types (such as vectors and data-frames) for their arguments and return values. User credentials are shared with command line 'git' through the git-credential store and ssh keys stored on disk or ssh-agent.
Authors: Jeroen Ooms [aut, cre] , Jennifer Bryan [ctb]
Maintainer: Jeroen Ooms <[email protected]>
License: MIT + file LICENSE
Version: 2.1.4.9000
Built: 2024-11-02 09:15:18 UTC
Source: https://github.com/r-lib/gert

Help Index


Git Archive

Description

Exports the files in your repository to a zip file that is returned by the function.

Usage

git_archive_zip(file = NULL, repo = ".")

Arguments

file

name of the output zip file. Default is returned by the function

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.

Value

path to the zip file that was created

See Also

Other git: git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


Git Branch

Description

Create, list, and checkout branches.

Usage

git_branch(repo = ".")

git_branch_list(local = NULL, repo = ".")

git_branch_checkout(branch, force = FALSE, orphan = FALSE, repo = ".")

git_branch_create(
  branch,
  ref = "HEAD",
  checkout = TRUE,
  force = FALSE,
  repo = "."
)

git_branch_delete(branch, repo = ".")

git_branch_move(branch, new_branch, force = FALSE, repo = ".")

git_branch_fast_forward(ref, repo = ".")

git_branch_set_upstream(upstream, branch = git_branch(repo), repo = ".")

git_branch_exists(branch, local = TRUE, repo = ".")

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.

local

set TRUE to only check for local branches, FALSE to check for remote branches. Use NULL to return all branches.

branch

name of branch to check out

force

overwrite existing branch

orphan

if branch does not exist, checkout unborn branch

ref

string with a branch/tag/commit

checkout

move HEAD to the newly created branch

new_branch

target name of the branch once the move is performed; this name is validated for consistency.

upstream

remote branch from git_branch_list, for example "origin/master"

See Also

Other git: git_archive, git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


GitHub Wrappers

Description

Fetch and checkout pull requests.

Usage

git_checkout_pull_request(pr = 1, remote = NULL, repo = ".")

git_fetch_pull_requests(pr = "*", remote = NULL, repo = ".")

Arguments

pr

number with PR to fetch or check out. Use "*" to fetch all pull requests.

remote

Optional. Name of a remote listed in git_remote_list(). If unspecified and the current branch is already tracking branch a remote branch, that remote is honored. Otherwise, defaults to origin.

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.

Details

By default git_fetch_pull_requests will download all PR branches. To remove these again simply use git_fetch(prune = TRUE).


Stage and commit changes

Description

To commit changes, start by staging the files to be included in the commit using git_add() or git_rm(). Use git_status() to see an overview of staged and unstaged changes, and finally git_commit() creates a new commit with currently staged files.

git_commit_all() is a convenience function that automatically stages and commits all modified files. Note that git_commit_all() does not add new, untracked files to the repository. You need to make an explicit call to git_add() to start tracking new files.

git_log() shows the most recent commits and git_ls() lists all the files that are being tracked in the repository. git_stat_files()

Usage

git_commit(message, author = NULL, committer = NULL, repo = ".")

git_commit_all(message, author = NULL, committer = NULL, repo = ".")

git_commit_info(ref = "HEAD", repo = ".")

git_commit_id(ref = "HEAD", repo = ".")

git_commit_stats(ref = "HEAD", repo = ".")

git_commit_descendant_of(ancestor, ref = "HEAD", repo = ".")

git_add(files, force = FALSE, repo = ".")

git_rm(files, repo = ".")

git_status(staged = NULL, pathspec = NULL, repo = ".")

git_conflicts(repo = ".")

git_ls(repo = ".", ref = NULL)

git_log(ref = "HEAD", max = 100, after = NULL, repo = ".")

git_stat_files(files, ref = "HEAD", repo = ".")

Arguments

message

a commit message

author

A git_signature value, default is git_signature_default().

committer

A git_signature value, default is same as author

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.

ref

revision string with a branch/tag/commit value

ancestor

a reference to a potential ancestor commit

files

vector of paths relative to the git root directory. Use "." to stage all changed files.

force

add files even if in gitignore

staged

return only staged (TRUE) or unstaged files (FALSE). Use NULL or NA to show both (default).

pathspec

character vector with paths to match

max

lookup at most latest n parent commits

after

date or timestamp: only include commits starting this date

Value

  • git_status(), git_ls(): A data frame with one row per file

  • git_log(): A data frame with one row per commit

  • git_commit(), git_commit_all(): A SHA

See Also

Other git: git_archive, git_branch(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag

Examples

oldwd <- getwd()
repo <- file.path(tempdir(), "myrepo")
git_init(repo)
setwd(repo)

# Set a user if no default
if(!user_is_configured()){
  git_config_set("user.name", "Jerry")
  git_config_set("user.email", "[email protected]")
}

writeLines(letters[1:6], "alphabet.txt")
git_status()

git_add("alphabet.txt")
git_status()

git_commit("Start alphabet file")
git_status()

git_ls()

git_log()

cat(letters[7:9], file = "alphabet.txt", sep = "\n", append = TRUE)
git_status()

git_commit_all("Add more letters")

# cleanup
setwd(oldwd)
unlink(repo, recursive = TRUE)

Get or set Git configuration

Description

Get or set Git options, as ⁠git config⁠ does on the command line. Global settings affect all of a user's Git operations (⁠git config --global⁠), whereas local settings are scoped to a specific repository (⁠git config --local⁠). When both exist, local options always win. Four functions address the four possible combinations of getting vs setting and global vs. local.

local global
get git_config() git_config_global()
set git_config_set() git_config_global_set()

Usage

git_config(repo = ".")

git_config_global()

git_config_set(name, value, repo = ".")

git_config_global_set(name, value)

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.

name

Name of the option to set

value

Value to set. Must be a string, logical, number or NULL (to unset).

Value

  • git_config(): a data.frame of the Git options "in force" in the context of repo, one row per option. The level column reveals whether the option is determined from global or local config.

  • git_config_global(): a data.frame, as for git_config(), except only for global Git options.

  • git_config_set(), git_config_global_set(): The previous value of name in local or global config, respectively. If this option was previously unset, returns NULL. Returns invisibly.

Note

All entries in the name column are automatically normalised to lowercase (see https://libgit2.org/libgit2/#HEAD/type/git_config_entry for details).

See Also

Other git: git_archive, git_branch(), git_commit(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag

Examples

# Set and inspect a local, custom Git option
r <- file.path(tempdir(), "gert-demo")
git_init(r)

previous <- git_config_set("aaa.bbb", "ccc", repo = r)
previous
cfg <- git_config(repo = r)
subset(cfg, level == "local")
cfg$value[cfg$name == "aaa.bbb"]

previous <- git_config_set("aaa.bbb", NULL, repo = r)
previous
cfg <- git_config(repo = r)
subset(cfg, level == "local")
cfg$value[cfg$name == "aaa.bbb"]

unlink(r, recursive = TRUE)

## Not run: 
# Set global Git options
git_config_global_set("user.name", "Your Name")
git_config_global_set("user.email", "[email protected]")
git_config_global()

## End(Not run)

Git Diff

Description

View changes in a commit or in the current working directory.

Usage

git_diff(ref = NULL, repo = ".")

git_diff_patch(ref = NULL, repo = ".")

Arguments

ref

a reference such as "HEAD", or a commit id, or NULL to the diff the working directory against the repository index.

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.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


Push and pull

Description

Functions to connect with a git server (remote) to fetch or push changes. The 'credentials' package is used to handle authentication, the credentials vignette explains the various authentication methods for SSH and HTTPS remotes.

Usage

git_fetch(
  remote = NULL,
  refspec = NULL,
  password = askpass,
  ssh_key = NULL,
  prune = FALSE,
  verbose = interactive(),
  repo = "."
)

git_remote_ls(
  remote = NULL,
  password = askpass,
  ssh_key = NULL,
  verbose = interactive(),
  repo = "."
)

git_push(
  remote = NULL,
  refspec = NULL,
  set_upstream = NULL,
  password = askpass,
  ssh_key = NULL,
  mirror = FALSE,
  force = FALSE,
  verbose = interactive(),
  repo = "."
)

git_clone(
  url,
  path = NULL,
  branch = NULL,
  password = askpass,
  ssh_key = NULL,
  bare = FALSE,
  mirror = FALSE,
  verbose = interactive()
)

git_pull(remote = NULL, rebase = FALSE, ..., repo = ".")

Arguments

remote

Optional. Name of a remote listed in git_remote_list(). If unspecified and the current branch is already tracking branch a remote branch, that remote is honored. Otherwise, defaults to origin.

refspec

string with mapping between remote and local refs. Default uses the default refspec from the remote, which usually fetches all branches.

password

a string or a callback function to get passwords for authentication or password protected ssh keys. Defaults to askpass which checks getOption('askpass').

ssh_key

path or object containing your ssh private key. By default we look for keys in ssh-agent and credentials::ssh_key_info.

prune

delete tracking branches that no longer exist on the remote, or are not in the refspec (such as pull requests).

verbose

display some progress info while downloading

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.

set_upstream

change the branch default upstream to remote. If NULL, this will set the branch upstream only if the push was successful and if the branch does not have an upstream set yet.

mirror

use the --mirror flag

force

use the --force flag

url

remote url. Typically starts with ⁠https://github.com/⁠ for public repositories, and ⁠https://[email protected]/⁠ or [email protected]/⁠ for private repos. You will be prompted for a password or pat when needed.

path

Directory of the Git repository to create.

branch

name of branch to check out locally

bare

use the --bare flag

rebase

if TRUE we try to rebase instead of merge local changes. This is not possible in case of conflicts (you will get an error).

...

arguments passed to git_fetch

Details

Use git_fetch() and git_push() to sync a local branch with a remote branch. Here git_pull() is a wrapper for git_fetch() which then tries to fast-forward the local branch after fetching.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag

Examples

{# Clone a small repository
git_dir <- file.path(tempdir(), 'antiword')
git_clone('https://github.com/ropensci/antiword', git_dir)

# Change into the repo directory
olddir <- getwd()
setwd(git_dir)

# Show some stuff
git_log()
git_branch_list()
git_remote_list()

# Add a file
write.csv(iris, 'iris.csv')
git_add('iris.csv')

# Commit the change
jerry <- git_signature("Jerry", "[email protected]")
git_commit('added the iris file', author = jerry)

# Now in the log:
git_log()

# Cleanup
setwd(olddir)
unlink(git_dir, recursive = TRUE)
}

Git Ignore

Description

Test if files would be ignored by .gitignore rules

Usage

git_ignore_path_is_ignored(path, repo = ".")

Arguments

path

A character vector of paths to test within the repo

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.

Value

A logical vector the same length as path, indicating if the paths would be ignored.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


Merging tools

Description

Use git_merge to merge a branch into the current head. Based on how the branches have diverged, the function will select a fast-forward or merge-commit strategy.

Usage

git_merge(ref, commit = TRUE, squash = FALSE, repo = ".")

git_merge_stage_only(ref, squash = FALSE, repo = ".")

git_merge_find_base(ref, target = "HEAD", repo = ".")

git_merge_analysis(ref, repo = ".")

git_merge_abort(repo = ".")

Arguments

ref

branch or commit that you want to merge

commit

automatically create a merge commit if the merge succeeds without conflicts. Set this to FALSE if you want to customize your commit message/author.

squash

omits the second parent from the commit, which make the merge a regular single-parent commit.

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.

target

the branch where you want to merge into. Defaults to current HEAD.

Details

By default git_merge automatically commits the merge commit upon success. However if the merge fails with merge-conflicts, or if commit is set to FALSE, the changes are staged and the repository is put in merging state, and you have to manually run git_commit or git_merge_abort to proceed.

Other functions are more low-level tools that are used by git_merge. git_merge_find_base looks up the commit where two branches have diverged (i.e. the youngest common ancestor). The git_merge_analysis is used to test if a merge can simply be fast forwarded or not.

The git_merge_stage_only function applies and stages changes, without committing or fast-forwarding.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


Open local repository

Description

Returns a pointer to a libgit2 repository object.This function is mainly for internal use; users should simply reference a repository in gert by by the path to the directory.

Usage

git_open(repo = ".")

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.

Value

an pointer to the libgit2 repository

Examples

r <- tempfile(pattern = "gert")
git_init(r)
r_ptr <- git_open(r)
r_ptr
git_open(r_ptr)
git_info(r)

# cleanup
unlink(r, recursive = TRUE)

Cherry-Pick and Rebase

Description

A cherry-pick applies the changes from a given commit (from another branch) onto the current branch. A rebase resets the branch to the state of another branch (upstream) and then re-applies your local changes by cherry-picking each of your local commits onto the upstream commit history.

Usage

git_rebase_list(upstream = NULL, repo = ".")

git_rebase_commit(upstream = NULL, repo = ".")

git_cherry_pick(commit, repo = ".")

git_ahead_behind(upstream = NULL, ref = "HEAD", repo = ".")

Arguments

upstream

branch to which you want to rewind and re-apply your local commits. The default uses the remote upstream branch with the current state on the git server, simulating git_pull.

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.

commit

id of the commit to cherry pick

ref

string with a branch/tag/commit

Details

git_rebase_list shows your local commits that are missing from the upstream history, and if they conflict with upstream changes. It does so by performing a rebase dry-run, without committing anything. If there are no conflicts, you can use git_rebase_commit to rewind and rebase your branch onto upstream. Gert only support a clean rebase; it never leaves the repository in unfinished "rebasing" state. If conflicts arise, git_rebase_commit will raise an error without making changes.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_remote, git_repo, git_reset(), git_signature(), git_stash, git_tag


Git Remotes

Description

List, add, configure, or remove remotes.

Usage

git_remote_list(repo = ".")

git_remote_add(url, name = "origin", refspec = NULL, repo = ".")

git_remote_remove(remote, repo = ".")

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

git_remote_set_url(url, remote = NULL, repo = ".")

git_remote_set_pushurl(url, remote = NULL, repo = ".")

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

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.

url

server url (https or ssh)

name

unique name for the new remote

refspec

optional string with the remote fetch value

remote

name of an existing remote. Default NULL means the remote from the upstream of the current branch.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_repo, git_reset(), git_signature(), git_stash, git_tag


Create or discover a local Git repository

Description

Use git_init() to create a new repository or git_find() to discover an existing local repository. git_info() shows basic information about a repository, such as the SHA and branch of the current HEAD.

Usage

git_init(path = ".", bare = FALSE)

git_find(path = ".")

git_info(repo = ".")

Arguments

path

the location of the git repository, see details.

bare

if true, a Git repository without a working directory is created

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.

Details

For git_init() the path parameter sets the directory of the git repository to create. If this directory already exists, it must be empty. If it does not exist, it is created, along with any intermediate directories that don't yet exist. For git_find() the path arguments specifies the directory at which to start the search for a git repository. If it is not a git repository itself, then its parent directory is consulted, then the parent's parent, and so on.

Value

The path to the Git repository.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_reset(), git_signature(), git_stash, git_tag

Examples

# directory does not yet exist
r <- tempfile(pattern = "gert")
git_init(r)
git_find(r)

# create a child directory, then a grandchild, then search
r_grandchild_dir <- file.path(r, "aaa", "bbb")
dir.create(r_grandchild_dir, recursive = TRUE)
git_find(r_grandchild_dir)

# cleanup
unlink(r, recursive = TRUE)

# directory exists but is empty
r <- tempfile(pattern = "gert")
dir.create(r)
git_init(r)
git_find(r)

# cleanup
unlink(r, recursive = TRUE)

Reset your repo to a previous state

Description

  • git_reset_hard() resets the index and working tree

  • git_reset_soft() does not touch the index file or the working tree

  • git_reset_mixed() resets the index but not the working tree.

Usage

git_reset_hard(ref = "HEAD", repo = ".")

git_reset_soft(ref = "HEAD", repo = ".")

git_reset_mixed(ref = "HEAD", repo = ".")

Arguments

ref

string with a branch/tag/commit

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.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_signature(), git_stash, git_tag


Author Signature

Description

A signature contains the author and timestamp of a commit. Each commit includes a signature of the author and committer (which can be identical).

Usage

git_signature_default(repo = ".")

git_signature(name, email, time = NULL)

git_signature_parse(sig)

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.

name

Real name of the committer

email

Email address of the committer

time

timestamp of class POSIXt or NULL

sig

string in proper "First Last <[email protected]>" format, see details.

Details

A signature string has format "Real Name <email> timestamp tzoffset". The ⁠timestamp tzoffset⁠ piece can be omitted in which case the current local time is used. If not omitted, timestamp must contain the number of seconds since the Unix epoch and tzoffset is the timezone offset in hhmm format (note the lack of a colon separator)

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_stash, git_tag

Examples

# Your default user
try(git_signature_default())

# Specify explicit name and email
git_signature("Some committer", "[email protected]")

# Create signature for an hour ago
(sig <- git_signature("Han", "[email protected]", Sys.time() - 3600))

# Parse a signature
git_signature_parse(sig)
git_signature_parse("Emma <[email protected]>")

Stashing changes

Description

Temporary stash away changed from the working directory.

Usage

git_stash_save(
  message = "",
  keep_index = FALSE,
  include_untracked = FALSE,
  include_ignored = FALSE,
  repo = "."
)

git_stash_pop(index = 0, repo = ".")

git_stash_drop(index = 0, repo = ".")

git_stash_list(repo = ".")

Arguments

message

optional message to store the stash

keep_index

changes already added to the index are left intact in the working directory

include_untracked

untracked files are also stashed and then cleaned up from the working directory

include_ignored

ignored files are also stashed and then cleaned up from the working directory

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.

index

The position within the stash list. 0 points to the most recent stashed state.

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_tag


Submodules

Description

Interact with submodules in the repository.

Usage

git_submodule_list(repo = ".")

git_submodule_info(submodule, repo = ".")

git_submodule_init(submodule, overwrite = FALSE, repo = ".")

git_submodule_set_to(submodule, ref, checkout = TRUE, repo = ".")

git_submodule_add(url, path = basename(url), ref = "HEAD", ..., repo = ".")

git_submodule_fetch(submodule, ..., repo = ".")

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.

submodule

name of the submodule

overwrite

overwrite existing entries

ref

a branch or tag or hash with

checkout

actually switch the contents of the directory to this commit

url

full git url of the submodule

path

relative of the submodule

...

extra arguments for git_fetch for authentication things


Git Tag

Description

Create and list tags.

Usage

git_tag_list(match = "*", repo = ".")

git_tag_create(name, message, ref = "HEAD", repo = ".")

git_tag_delete(name, repo = ".")

git_tag_push(name, ..., repo = ".")

Arguments

match

pattern to filter tags (use * for wildcard)

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.

name

tag name

message

tag message

ref

target reference to tag

...

other arguments passed to git_push

See Also

Other git: git_archive, git_branch(), git_commit(), git_config(), git_diff(), git_fetch(), git_ignore, git_merge(), git_rebase(), git_remote, git_repo, git_reset(), git_signature(), git_stash


Show libgit2 version and capabilities

Description

libgit2_config() reveals which version of libgit2 gert is using and which features are supported, such whether you are able to use ssh remotes.

Usage

libgit2_config()

Examples

libgit2_config()

Test if a Git user is configured

Description

This function exists mostly to guard examples that rely on having a user configured, in order to make commits. user_is_configured() makes no distinction between local or global user config.

Usage

user_is_configured(repo = ".")

Arguments

repo

An optional repo, in the sense of git_open().

Value

TRUE if user.name and user.email are set locally or globally, FALSE otherwise.

Examples

user_is_configured()