This tool allows an LLM to run gert::git_diff_patch(), equivalent to
git diff in the terminal, and to see the detailed changes made in a commit.
See also
Other git tools:
btw_tool_git_branch_checkout(),
btw_tool_git_branch_create(),
btw_tool_git_branch_list(),
btw_tool_git_commit(),
btw_tool_git_log(),
btw_tool_git_status()
Examples
withr::with_tempdir({
gert::git_init()
gert::git_config_set("user.name", "R Example")
gert::git_config_set("user.email", "ex@example.com")
writeLines("hello, world", "hello.md")
gert::git_add("hello.md")
gert::git_commit("Initial commit")
writeLines("hello, universe", "hello.md")
# What the LLM sees
cat(btw_tool_git_diff()@value)
})
#> ```diff diff --git a/hello.md b/hello.md
#> index 4b5fa63..d972925 100644
#> --- a/hello.md
#> +++ b/hello.md
#> @@ -1 +1 @@
#> -hello, world
#> +hello, universe
#> ```
