extract_commit: Extract a commit from a Git repository

View source: R/git.R

extract_commitR Documentation

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

## Not run: 
# Most recent commit
extract_commit(".", 1)
# Penultimate commit
extract_commit(".", 2)

## End(Not run)

jdblischak/workflowr documentation built on Nov. 26, 2024, 5:14 p.m.