as far as I understand it (please correct me if I’m wrong), to use Git inside RStudio you must:
- create a local repository, at least (I don’t think a remote repository is needed too)
- you can only compare files having the same name, i.e., two different commits of the same repo, but not two text files with different names
Actually, neither of those is true if you use the command-line git
.
-
If you have Git installed, you can use its
diff
functionality on files that aren't part of any repository - just use the--no-index
option. I do this fairly frequently, just because I like the colorized (and sometimes word-level) output, and because I havegit diff
configured to use a pager without explicitly piping toless
or similar. -
When using
--no-index
, you can diff two files just by listing both filenames on the command line.
So I'd recommend:
git diff --no-index file1.Rmd file2.Rmd
-- the only disadvantage of which is that you have to leave the Rstudio graphical environment.