Open assignUser opened 3 years ago
git_diff()
returns a data frame, with a column containing the file name for each change? For example:
git_diff('HEAD^')$new
Shows the files changed in your most recent commit.
Right. But only files changed in this commit. (or current working dir vs. last commit)
Not the changed files between two commits as you would with git diff ref1 ref2 --
(--name-only just for better readability):
$> git diff --name-only main run-on-change --
API
NAMESPACE
R/core.R
R/source.R
R/utils.R
inst/script.R
man/add_lib_dirs.Rd
man/benchmark_run_ref.Rd
tests/testthat/test-utils.R
I am looking for this behaviour because I want to run some tests/benchmarks on pull requests only if the relevant file has changed between the branches (e.g. main and devel), so it would not be enough to only check the files changed in the last/one specific commit.
For now I can use system
but I would rather use your great package to do it within R 😃
edit: And thank you for your quick response!
I was looking for
git diff
in gert two compare to refs . I foundgit_diff
which can only display the changes in the passed ref, which is the most basic function ofgit diff
.Is there a way to compare two refs (e.g. two branches) with gert and find the changed files between them (
git diff --name-only branch1 branch2
)?