R: Push and Pull

fetch {gert} | R Documentation

## Push and Pull

### Description

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

### Usage

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

    git_push(remote = NULL, refspec = 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(..., repo = ".")

### Arguments

`remote` | name of a remote listed in `git_remote_list()`
`refspec` | string with mapping between remote and local refs
`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.
`verbose` | display some progress info while downloading
`repo` | a path to an existing repository, or a `git_repository` object as returned by git_open, git_init or git_clone.
`mirror` | use the `--mirror` flag
`force` | use the `--force` flag
`url` | remote url. Typically starts with `https://github.com/` for public repositories, and `https://yourname@github.com/` or `git@github.com/` for private repos. You will be prompted for a password or pat when needed.
`path` | directory of the git repository. For `git_init` or `git_clone` this must be a non-existing or empty directory.
`branch` | name of branch to check out locally
`bare` | use the `--bare` flag
`...` | arguments passed to git_fetch

### See Also

Other git: `branch`, `commit`, `git_config`, `repository`, `signature`

### 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", "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)
    }

[Package gert version 0.3 Index]