git2r (version 0.10.1)

commit: Commit

Description

Commit

Usage

commit(repo, message = NULL, all = FALSE, session = FALSE,
  reference = "HEAD", author = default_signature(repo),
  committer = default_signature(repo))

## S3 method for class 'git_repository': commit(repo, message = NULL, all = FALSE, session = FALSE, reference = "HEAD", author = default_signature(repo), committer = default_signature(repo))

Arguments

repo
The repository object.
message
The commit message.
all
Stage modified and deleted files. Files not added to Git are not affected.
session
Add sessionInfo to commit message. Default is FALSE.
reference
Name of the reference that will be updated to point to this commit.
author
Signature with author and author time of commit.
committer
Signature with committer and commit time of commit.

Value

  • git_commit 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")

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

Run the code above in your browser using DataLab