Learn R Programming

workflowr (version 1.7.1)

extract_commit: Extract a commit from a Git repository

Description

extract_commit extracts the 7-digit SHA1 identifier and message for a specified commit.

Usage

extract_commit(path, num)

Value

A list with the named elements sha1 and message (both characters). If a Git repository is not found at path, both are

NA.

Arguments

path

character. Specify the path to a directory that is a Git repository (or any subdirectory of the Git repository).

num

numeric. The number of the commit to extract in reverse chronological order. In other words, 1 is the most recent commit, 2 is the second most recent commit, etc.

Examples

Run this code
if (FALSE) {
# Most recent commit
extract_commit(".", 1)
# Penultimate commit
extract_commit(".", 2)
}

Run the code above in your browser using DataLab