rstats-wtf / wtf-2019-rsc

What They Forgot to Teach You About R, 2019 January 15/16 @ rstudio::conf
https://rstd.io/wtf-2019-rsc
41 stars 75 forks source link

Best practices for .gitignore #13

Open khailper opened 5 years ago

khailper commented 5 years ago

What sorts of things should be in .gitignore beyond the defaults? If it's something like a whole directory (say, Data), can that be done with something like regex or do the files need to be added individually?

gaborcsardi commented 5 years ago
  1. Things that appear frequently in the project folder while you are working on the project, but you don't want to put them in the repository.

  2. They are shell globs. I.e. the same format the bash shell supports. Not regular expressions. It is quite flexible. See this: https://stackoverflow.com/a/8527650/604364 and this: https://en.wikipedia.org/wiki/Glob_%28programming%29#Syntax

jimhester commented 5 years ago

A useful resource I like is https://www.gitignore.io/

You can search for an OS, e.g. https://www.gitignore.io/api/macos or https://www.gitignore.io/api/windows

Or for a programming language, e.g. https://www.gitignore.io/api/r or https://www.gitignore.io/api/python

Also I think it is pretty useful to put most of these in a global gitignore (https://help.github.com/articles/ignoring-files/#create-a-global-gitignore for setup instructions has setup instructions)