blame {git2r} | R Documentation

## Get blame for file

### Description

Get blame for file

### Usage

    blame(repo, path)

    ## S4 method for signature 'git_repository,character'
    blame(repo, path)

### Arguments

`repo` | The repository
`path` | Path to the file to consider

### Value

S4 class git_blame object

### Examples

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

[Package git2r version 0.20.0 Index]