reflog-methods: List and view reflog information

Description Usage Arguments Value Examples

Description

List and view reflog information

Usage

1
2
3
4
5
6
7
reflog(repo, refname)

## S4 method for signature 'git_repository,missing'
reflog(repo)

## S4 method for signature 'git_repository,character'
reflog(repo, refname)

Arguments

repo

S4 class git_repository object.

refname

The name of the reference to list. 'HEAD' by default.

Value

S3 class git_reflog with git_reflog_entry objects.

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="[email protected]")

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

## View reflog
reflog(repo)

## End(Not run)

git2r documentation built on July 20, 2017, 1:03 a.m.

Related to reflog-methods in git2r...