1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/fetch.R 3\name{git_fetch} 4\alias{git_fetch} 5\alias{git_remote_ls} 6\alias{git_push} 7\alias{git_clone} 8\alias{git_pull} 9\title{Push and pull} 10\usage{ 11git_fetch( 12 remote = NULL, 13 refspec = NULL, 14 password = askpass, 15 ssh_key = NULL, 16 prune = FALSE, 17 verbose = interactive(), 18 repo = "." 19) 20 21git_remote_ls( 22 remote = NULL, 23 password = askpass, 24 ssh_key = NULL, 25 verbose = interactive(), 26 repo = "." 27) 28 29git_push( 30 remote = NULL, 31 refspec = NULL, 32 set_upstream = NULL, 33 password = askpass, 34 ssh_key = NULL, 35 mirror = FALSE, 36 force = FALSE, 37 verbose = interactive(), 38 repo = "." 39) 40 41git_clone( 42 url, 43 path = NULL, 44 branch = NULL, 45 password = askpass, 46 ssh_key = NULL, 47 bare = FALSE, 48 mirror = FALSE, 49 verbose = interactive() 50) 51 52git_pull(remote = NULL, rebase = FALSE, ..., repo = ".") 53} 54\arguments{ 55\item{remote}{Optional. Name of a remote listed in \code{\link[=git_remote_list]{git_remote_list()}}. If 56unspecified and the current branch is already tracking branch a remote 57branch, that remote is honored. Otherwise, defaults to \code{origin}.} 58 59\item{refspec}{string with mapping between remote and local refs. Default 60uses the default refspec from the remote, which usually fetches all branches.} 61 62\item{password}{a string or a callback function to get passwords for authentication 63or password protected ssh keys. Defaults to \link[askpass:askpass]{askpass} which 64checks \code{getOption('askpass')}.} 65 66\item{ssh_key}{path or object containing your ssh private key. By default we 67look for keys in \code{ssh-agent} and \link[credentials:ssh_credentials]{credentials::ssh_key_info}.} 68 69\item{prune}{delete tracking branches that no longer exist on the remote, or 70are not in the refspec (such as pull requests).} 71 72\item{verbose}{display some progress info while downloading} 73 74\item{repo}{The path to the git repository. If the directory is not a 75repository, parent directories are considered (see \link{git_find}). To disable 76this search, provide the filepath protected with \code{\link[=I]{I()}}. When using this 77parameter, always explicitly call by name (i.e. \verb{repo = }) because future 78versions of gert may have additional parameters.} 79 80\item{set_upstream}{change the branch default upstream to \code{remote}. 81If \code{NULL}, this will set the branch upstream only if the push was 82successful and if the branch does not have an upstream set yet.} 83 84\item{mirror}{use the \code{--mirror} flag} 85 86\item{force}{use the \code{--force} flag} 87 88\item{url}{remote url. Typically starts with \verb{https://github.com/} for public 89repositories, and \verb{https://yourname@github.com/} or \verb{git@github.com/} for 90private repos. You will be prompted for a password or pat when needed.} 91 92\item{path}{Directory of the Git repository to create.} 93 94\item{branch}{name of branch to check out locally} 95 96\item{bare}{use the \code{--bare} flag} 97 98\item{rebase}{if TRUE we try to rebase instead of merge local changes. This 99is not possible in case of conflicts (you will get an error).} 100 101\item{...}{arguments passed to \link{git_fetch}} 102} 103\description{ 104Functions to connect with a git server (remote) to fetch or push changes. 105The 'credentials' package is used to handle authentication, the 106\href{https://docs.ropensci.org/credentials/articles/intro.html}{credentials vignette} 107explains the various authentication methods for SSH and HTTPS remotes. 108} 109\details{ 110Use \code{\link[=git_fetch]{git_fetch()}} and \code{\link[=git_push]{git_push()}} to sync a local branch with a remote 111branch. Here \code{\link[=git_pull]{git_pull()}} is a wrapper for \code{\link[=git_fetch]{git_fetch()}} which then tries to 112\link[=git_branch_fast_forward]{fast-forward} the local branch after fetching. 113} 114\examples{ 115{# Clone a small repository 116git_dir <- file.path(tempdir(), 'antiword') 117git_clone('https://github.com/ropensci/antiword', git_dir) 118 119# Change into the repo directory 120olddir <- getwd() 121setwd(git_dir) 122 123# Show some stuff 124git_log() 125git_branch_list() 126git_remote_list() 127 128# Add a file 129write.csv(iris, 'iris.csv') 130git_add('iris.csv') 131 132# Commit the change 133jerry <- git_signature("Jerry", "jerry@hotmail.com") 134git_commit('added the iris file', author = jerry) 135 136# Now in the log: 137git_log() 138 139# Cleanup 140setwd(olddir) 141unlink(git_dir, recursive = TRUE) 142} 143} 144\seealso{ 145Other git: 146\code{\link{git_archive}}, 147\code{\link{git_branch}()}, 148\code{\link{git_commit}()}, 149\code{\link{git_config}()}, 150\code{\link{git_diff}()}, 151\code{\link{git_merge}()}, 152\code{\link{git_rebase}()}, 153\code{\link{git_remote}}, 154\code{\link{git_repo}}, 155\code{\link{git_signature}()}, 156\code{\link{git_stash}}, 157\code{\link{git_tag}} 158} 159\concept{git} 160