Join the community!
Visit our GitHub or LinkedIn page to join the Tilburg Science Hub community, or check out our contributors' Hall of Fame!
Want to change something or add new content? Click the Contribute button!
Let Git/GitHub know which files to exclude from versioning
By default, Git/GitHub track any files that you have created, for example:
- large data files (that you wont be able to upload to GitHub),
- files that are generated by code (and hence need not to be versioned), and
- even sensitive passwords that you may have stored in your code accidentally.
Luckily, Git offers a convenient way to exclude files and directories from versioning.
-
Create a new file in your project’s root directory, and call it
.gitignore
(remember to use the.
!) -
Edit the
.gitignore
file, and define which files or directories to exclude. For example,**/DIRNAME
excludes any directory calledDIRNAME
, and*pdf
excludes any PDF files. -
Save the
.gitignore
file, and rungit status
in your repository - the excluded files and directories won’t show up anymore!
Example
Check out a few example .gitignore
files for inspiration, or copy-paste the following to your own .gitignore
:
**/rbin/
**/raw/
*RData
*pdf
**/audit
**/input
**/output
**/temp
**/zip
*csv
*xlsx
*~*
*log
*.Rhistory
**/exports
**.ipynb_checkpoints
**__pycache__
*.log
slides/*.gz
slides/*.snm
slides/*.toc
slides/*.nav
slides/*.out
slides/*.aux
.RProfile