Captain Hat
Captain Hat

Reputation: 3247

Does Rstudio put '.Rproj.user' and '.Ruserdata' in '.gitignore'?

Whenever I use git with R / Rstudio, the .gitignore file appears to contain two items by default: .Rproj.user and .Ruserdata. I don't want to change this, I just want to understand why it happens. Is it some kind of Rstudio default? I normally make commits via the integrated terminal, but I never explicitly add anything to .gitignore myself.

A clarifying follow up question: What would I have to do to prevent this from occuring? I'm guessing that if I wrote a .RProj and some .Rs using notepad and pushed via a standalone Git bash I would retain an empty `.gitignore' in my project directory.

Hope that all makes sense, thanks for any help you can give.

Upvotes: 2

Views: 1076

Answers (1)

Konrad Rudolph
Konrad Rudolph

Reputation: 545855

Is it some kind of Rstudio default?

Yes. RStudio (rightly) assumes that you probably don’t want to commit user-specific configuration.

What would I have to do to prevent this from occuring?

Rather than attempt to prevent it, you can simply edit .gitignore and remove the entries of files that you want to commit. That said, I would generally advise against this, as these files shouldn’t be committed.

Upvotes: 5

Related Questions