Learn R Programming

workflowr (version 0.7.0)

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)

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.

Value

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

Examples

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

Run the code above in your browser using DataLab