Skip to contents

This function uses the git log command to retrieve the last N commit information for a specified file. The information includes the commit hash, author, and commit message.

Usage

get_last_n_commit_info(filepath, n = 1)

Arguments

filepath

A character string specifying the path to the file for which commit information is to be retrieved.

n

An integer specifying the number of commit information to retrieve. The default is 1, which retrieves the most recent commit information.

Value

A flat list of commit information, including the commit hash, author, and message for the last N commits.

Note

This function currently only works on Windows systems due to the use of the shell() function.

Examples

if (FALSE) { # \dontrun{
# Retrieve the last commit information for a file
get_last_n_commit_info(filepath = "/path/to/file.R")

# Retrieve the last  5 commit information for a file
get_last_n_commit_info(filepath = "/path/to/file.R", n = 5)
} # }