git2r (version 0.10.1)

show,git_diff-method: Show a diff

Description

Show a diff

Usage

## S3 method for class 'git_diff':
show(object)

Arguments

object
The diff object.

Examples

Run this code
## 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")

## Create a file, add, commit
writeLines("Hello world!", file.path(path, "test.txt"))
add(repo, "test.txt")
commit(repo, "Commit message")

## Change the file
writeLines(c("Hello again!", "Here is a second line", "And a third"),
           file.path(path, "test.txt"))

## Brief summary of diff between index and workdir
diff(repo)

Run the code above in your browser using DataCamp Workspace