Skip to content

Instantly share code, notes, and snippets.

@benmarwick
Last active February 22, 2023 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmarwick/3eb501c181c8fea6968e531a09d651e8 to your computer and use it in GitHub Desktop.
Save benmarwick/3eb501c181c8fea6968e531a09d651e8 to your computer and use it in GitHub Desktop.
How to compare the current commit of an RMarkdown file with the most recent commit. Useful when we merge a pull request and want to check again how it has changed the document
# reviewer pkg comes from https://ropenscilabs.github.io/reviewer/index.html
# remotes::install_github("ropenscilabs/reviewer")
browseURL(reviewer::diff_rmd("path/to/my-document.Rmd",
# this gets the sha of the previous commit
git2r::commits(n=2)[[2]]$sha)$raw)
# result will open in a web browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment