Skip to contents

Returns a character vector of paths changed between base_ref and head_ref using git diff --name-only. Works for commits, branches, and tags. Paths are relative to the repo root.

Usage

git_changed_files(dir = ".", base_ref = "origin/master", head_ref = "HEAD")

Arguments

dir

Path to the git repository (defaults to current directory).

base_ref

Git ref or commit to diff from. Defaults to "origin/master".

head_ref

Git ref or commit to diff to. Defaults to "HEAD".

Value

Character vector of changed file paths (possibly empty).

Examples

if (FALSE) { # \dontrun{
git_changed_files()
git_changed_files(base_ref = "main", head_ref = "HEAD")
} # }