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
.gitignorefile, and define which files or directories to exclude. For example,
**/DIRNAMEexcludes any directory called
.gitignorefile, and run
git statusin your repository - the excluded files and directories won’t show up anymore!
Check out a few example
.gitignore files for inspiration, or copy-paste the following to your own
**/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