22

I added the folder .Rproj.user to .gitignore. However, some files contained in it still show up (see screenshot). Any ideas what can I do about it?

enter image description here

Update

No changes after adding .Rproj.user/**

enter image description here

Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88

1 Answers1

40

First of all your files are already committed so you have to remove it from the repo:

# Once you add files to git, it will keep tracking them,  
# so we have to delete them and commit your deletion
git rm -r --cached .Rproj.user/**

# Commit the deleted files
git commit -m "Removed files...."

# now add it to the `.gitignore` and the files will be ignored
echo '.Rproj.user/**' > .gitignore

You need to mark it as folder.
In order to do so add the 2 ** as described above

enter image description here

P.S.

Here is a cool hook which will block that kind of files to be added when you try to push them to the server.

What are some more forceful ways than a .gitignore to keep (force) files out of a repo?

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167