| blame {git2r} | R Documentation |
Get blame for file
blame(repo, path) ## S4 method for signature 'git_repository,character' blame(repo, path)
repo |
The repository |
path |
Path to the file to consider |
S4 class git_blame object
## Not run:
## Initialize a temporary repository
path <- tempfile(pattern="git2r-")
dir.create(path)
repo <- init(path)
## Create a first user and commit a file
config(repo, user.name="Alice", user.email="alice@example.org")
writeLines("Hello world!", file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "First commit message")
## Create a second user and change the file
config(repo, user.name="Bob", user.email="bob@example.org")
writeLines(c("Hello world!", "HELLO WORLD!", "HOLA"),
file.path(path, "example.txt"))
add(repo, "example.txt")
commit(repo, "Second commit message")
## Check blame
blame(repo, "example.txt")
## End(Not run)