.gitignored files still shown in RStudio

后端 未结 1 400
温柔的废话
温柔的废话 2021-02-13 18:47

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?

1条回答
  •  难免孤独
    2021-02-13 19:45

    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?

    0 讨论(0)
提交回复
热议问题