Should *.Rproj files be added to .gitignore?

By default .Rproj.user files are added to .gitignore, but why not *.Rproj?

I wonder if .Rproj files should also be added to the .gitignore file.

When a project is newly created, the file is rather small (~ 234 Bytes) so it shouldn't really matter with respect to size.
Are there other files that should be added to gitignore by default? Maybe *.zip files?


.Rproj file can contain some information about the project like how to build the project for example. I think it could be included in git to convey this information. It allows to clone a rstudio project from git repos. Other file form are studio are user or session specific it is why they should not be included for me.

In git, you should ignore files related to IDE or build file like binary. Small data can be fine if for testing for example. Website like can help to know what file to ignore. Example for R


IMO, you should not include *.Rpoj in your .gitignore if nothing for the simple fact that you can set the project's options to never save/load the workspace on exit/startup, ensuring that you can share the project without worrying about an old image cluttering up your collaborator's workspace.

Moreover, it can really help with new collaborators who may be unfamiliar with R since you can tell them to download the project folder and double-click on the *.Rproj file to open it, setting them in the correct working directory every time.


We generally recommend including your .Rproj in your Git repo for the reasons outlined above. If you have any remaining doubts, check and see what the pros do!


I'll agree with the others. As @jonathan's examples show, .Rproj settings help enforce some code style choices with defaults for spacing.