commits {git2r} | R Documentation

## Commits

### Description

Commits

### Usage

    commits(repo, ...)

    ## S4 method for signature 'missing'
    commits(topological = TRUE, time = TRUE,
      reverse = FALSE, n = NULL, ...)

    ## S4 method for signature 'git_repository'
    commits(repo, topological = TRUE, time = TRUE,
      reverse = FALSE, n = NULL, ...)

### Arguments

`repo` | The repository `object` `git_repository`. If the `repo` argument is missing, the repository is searched for with `discover_repository` in the current working directory.
`...` | Additional arguments to commits.
`topological` | Sort the commits in topological order (parents before children); can be combined with time sorting. Default is TRUE.
`time` | Sort the commits by commit time; Can be combined with topological sorting. Default is TRUE.
`reverse` | Sort the commits in reverse order; can be combined with topological and/or time sorting. Default is FALSE.
`n` | The upper limit of the number of commits to output. The defualt is NULL for unlimited number of commits.

### Value

list of commits in repository

### Examples

    ## Not run:
    ## Initialize a repository
    path <- tempfile(pattern="git2r-")
    dir.create(path)
    repo <- init(path)

    ## Config user
    config(repo, user.name="Alice", user.email="alice@example.org")

    ## Write to a file and commit
    writeLines("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
               file.path(path, "example.txt"))
    add(repo, "example.txt")
    commit(repo, "First commit message")

    ## Change file and commit
    writeLines(c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
                 "eiusmod tempor incididunt ut labore et dolore magna aliqua."),
               file.path(path, "example.txt"))
    add(repo, "example.txt")
    commit(repo, "Second commit message")

    ## Change file again and commit
    writeLines(c("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do",
                 "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad",
                 "minim veniam, quis nostrud exercitation ullamco laboris nisi ut"),
               file.path(path, "example.txt"))
    add(repo, "example.txt")
    commit(repo, "Third commit message")

    ## List commits in repository
    commits(repo)

    ## End(Not run)

[Package git2r version 0.20.0 Index]