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.
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 = ".")
| remote | Optional. Name of a remote listed in |
|---|---|
| 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 |
| ssh_key | path or object containing your ssh private key. By default we
look for keys in |
| 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 |
| set_upstream | change the branch default upstream to |
| mirror | use the |
| force | use the |
| url | remote url. Typically starts with |
| path | Directory of the Git repository to create. |
| branch | name of branch to check out locally |
| bare | use the |
| 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 |
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.
Other git:
git_archive,
git_branch(),
git_commit(),
git_config(),
git_diff(),
git_merge(),
git_rebase(),
git_remote,
git_repo,
git_signature(),
git_stash,
git_tag
{# 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", "jerry@hotmail.com") git_commit('added the iris file', author = jerry) # Now in the log: git_log() # Cleanup setwd(olddir) unlink(git_dir, recursive = TRUE) }