0

I have created a repository. I've been using GitHub desktop and RStudio to version control my project.

The folder setup I've created is:

  • Master project. (r files)
  • data prep scripts (r functions)
  • input data (rds files used in the master script from the r functions)
  • output files (XLSX files from script)

First off, I created a .gitignore with the /input_data syntax.

When I went to check GitHub it is still tracking those .rds files. Is that the correct syntax to prevent tracking of the files in the input_data folder?

If so, how do I stop these files from being tracked?

1615903
  • 32,635
  • 12
  • 70
  • 99
Jazzmatazz
  • 615
  • 7
  • 18
  • Possible duplicate of [Ignore files that have already been committed to a Git repository](https://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository) – 1615903 Jul 30 '17 at 08:01

2 Answers2

1

you can add *.rds to your .gitignore

or use

git rm --cached  -- <files>

from the git console

2oppin
  • 1,941
  • 20
  • 33
  • It appears that Github Desktop continues to pick up that .rds file even when following those steps and committing the updated .gitignore to my repository. Any other ideas? – Jazzmatazz Jul 31 '17 at 20:32
  • other idea - is to backup your folder/project/*.rds, then delete them from project, and commit that deletion. Then restore *.rds on local, and they should not be tracked again. Your remote repo still have (*.rds) stored, you need to say to it to remove them. Btw, maybe you will need to track them once again (one last time) to be able to commit changes(deletion). Then after restoring repeat rm --cached. – 2oppin Aug 01 '17 at 07:01
  • I tried that. I manually deleted all 3 .rds files from my local drive. That looks to be the fix. – Jazzmatazz Aug 01 '17 at 11:39
  • have you committed deletion? try to git pull will *.rds files appear again? – 2oppin Aug 01 '17 at 11:46
  • Can you walk me through how to do this? I'm a newbie. Also, going forward what are the best practices for creating a .gitignore? Do I push the .gitignore right after I create the repository? – Jazzmatazz Aug 01 '17 at 13:06
0

I believe git is still tracking your files because you added the /input_data to the .gitignore file after you pushed everything on your github repo.

All you have to do is to tell git to stop tracking those files. From your terminal run:

git rm --cached <file name>

Then add the /input_data/* into your .gitignore file, commit and push everything to your repo.

iulyanp
  • 71
  • 3