wflow_git_config: Configure Git settings

View source: R/wflow_git_config.R

wflow_git_configR Documentation

Configure Git settings

Description

wflow_git_config configures the global Git settings on the current machine. This is a convenience function to run Git commands from the R console instead of the Terminal. The same functionality can be achieved by running git config in the Terminal.

Usage

wflow_git_config(user.name = NULL, user.email = NULL, ..., overwrite = FALSE)

Arguments

user.name

character (default: NULL). Git user name. Git assigns an author when committing (i.e. saving) changes. If you have never used Git before on your computer, make sure to set this.

user.email

character (default: NULL). Git user email. Git assigns an email when committing (i.e. saving) changes. If you have never used Git before on your computer, make sure to set this.

...

Arbitrary Git settings, e.g. core.editor = "nano".

overwrite

logical (default: FALSE). Overwrite existing Git global settings.

Details

The main purpose of wflow_git_config is to set the user.name and user.email to use with Git commits. Note that these do not need to match the name and email you used to register your online account with a Git hosting service (e.g. GitHub or GitLab). However, it can also handle arbitrary Git settings (see examples below).

There are two main limitations of wflow_git_config for the sake of simplicity. First, wflow_git_config only affects the global Git settings that apply to all Git repositories on the local machine and is unable to configure settings for one specific Git repository. Second, wflow_git_config can only add or change the user.name and user.email settings, but not delete them. To perform either of these actions, please use git config in the Terminal.

Under the hood, wflow_git_config is a wrapper for config from the package git2r.

To learn more about how to configure Git, see the Software Carpentry lesson Setting Up Git.

Value

An object of class wflow_git_config, which is a list with the following elements:

  • user.name: The current global Git user.name

  • user.email: The current global Git user.email

  • all_settings: A list of all current global Git settings

Examples

## Not run: 

# View current Git settings
wflow_git_config()
# Set user.name and user.email
wflow_git_config(user.name = "A Name", user.email = "email@domain")
# Set core.editor (the text editor that Git opens to write commit messages)
wflow_git_config(core.editor = "nano")


## End(Not run)


jdblischak/workflowr documentation built on Nov. 26, 2024, 5:14 p.m.