wflow_git_pull pulls the remote files from your remote repository on GitHub into your repository on your local machine. This is a convenience function to run Git commands from the R console instead of the Terminal. The same functionality can be acheived by running git pull in the Terminal.

wflow_git_pull(remote = NULL, branch = NULL, username = NULL,
  password = NULL, dry_run = FALSE, project = ".")

Arguments

remote

character (default: NULL). The name of the remote repository. See Details for the default behavior.

branch

character (default: NULL). The name of the branch in the remote repository to pull from. If NULL, the name of the current local branch is used.

username

character (default: NULL). GitHub username. The user is prompted if necessary.

password

character (default: NULL). GitHub password. The user is prompted if necessary.

dry_run

logical (default: FALSE). Preview the proposed action but do not actually pull from the remote repository.

project

character (default: ".") By default the function assumes the current working directory is within the project. If this is not true, you'll need to provide the path to the project directory.

Value

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

  • remote: The remote repository.

  • branch: The branch of the remote repository.

  • username: GitHub username.

  • merge_result: The git_merge_result-class object returned by git2r (only included if dry_run == FALSE).

  • dry_run: The input argument dry_run.

Details

wflow_git_pull tries to choose sensible defaults if the user does not explicitly specify the remote repository and/or the remote branch:

  • If both remote and branch are NULL, wflow_git_pull checks to see if the current local branch is tracking a remote branch. If yes, it pulls to this tracked remote branch.

  • If the argument remote is left as NULL and there is only one remote, it is used. If there is more than one remote, the one named "origin" is used.

  • If the argument branch is left as NULL, the name of the current local branch is used (referred to as HEAD by Git).

Under the hood, wflow_git_pull is a wrapper for pull from the package git2r.

Examples

not_run({ # Pull from remote repository wflow_git_pull() # Preview by running in dry run mode wflow_git_pull(dry_run = TRUE) })