.gitignore files not ignored when pulling remote changes

This question already has an answer here:

  • Ignore files that have already been committed to a Git repository [duplicate] 21 answers

  • If you don't want to track them, you need to remove them from the history first, and push that removal

    git rm --cached -- afile
    git add -u .
    git commit
    git push
    

    As soon as the file is removed locally (the --cached keeps it on your disk), your .gitignore will work.
    But any git pull would get back that file if it was versioned on the remote repo side. Hence the need to push (publish) that removal, provided that you are sure every other user should not see that file anymore as well.


    .gitignore - Specifies intentionally untracked files to ignore

    In this case your .idea directory is already tracked in git. So you need to remove it from repo first.

    After that if you add .idea folder into your .gitignore file, it won't show up among untracked files.


    不要忘记提交并推送你的gitignore文件。

    链接地址: http://www.djcxy.com/p/23402.html

    上一篇: gitignore不删除文件

    下一篇: 。拉动远程更改时不会忽略.gitignore文件