.gitignored文件仍显示在RStudio中 [英] .gitignored files still shown in RStudio
本文介绍了.gitignored文件仍显示在RStudio中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将文件夹.Rproj.user
添加到了.gitignore
.但是,其中包含的某些文件仍然会显示(请参见屏幕截图).有什么想法我该怎么办?
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?
更新
添加.Rproj.user/**
推荐答案
首先您的所有文件都已提交,因此您必须将其从存储库中删除:
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
您需要将其标记为文件夹.
为此,如上所述添加2个**
You need to mark it as folder.
In order to do so add the 2 **
as described above
这是一个很酷的钩子,当您尝试将其添加到服务器时,它将阻止添加此类文件.
Here is a cool hook which will block that kind of files to be added when you try to push them to the server.