Commits

Share:

Description

Commits

Usage

1
2
3
4
5
6
7
8
9
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.