Search code examples
gitgithubintellij-ideagitignoregit-rm

Stop tracking file locally, but let other repo users keep tracking it?


I'm collaborating on an IntelliJ IDEA project using Git and GitHub. The original creator of the repo added the IntelliJ .idea folder to the repo, and I find it annoying to see changes to IDE files constantly popping up in the commit dialog. The .idea folder is in fact added to .gitignore, but that happened after they were already tracked.

I removed the folder from the local repo using git rm --cached -r -f .idea/, which to my understanding removes the files from the repo.

However, other collaborators still want to be able to commit and push their changes to the .idea folder. So I just want to ignore the .idea folder locally.

The folder and it's contents show up in the commit dialog as deleted right now, and I'm worried that if I commit and push now, it will also affect other collaborators - right? What should I do to just ignore this folder locally but not affect others who still want to be able to commit and push their changes to the folder? Is this even possible?


Solution

  • Try git update-index --skip-worktree [file].

    As pointed out in the comments, this answer provides more insight.