.gitignored files still shown in RStudio

2020-06-13 02:31发布

问题:

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?

Update

No changes after adding .Rproj.user/**

回答1:

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

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?



标签: r git rstudio