1

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?

Magnus
  • 17,157
  • 19
  • 104
  • 189
  • 1
    Use `skip-worktree` feature: https://stackoverflow.com/a/13631525/717372 – Philippe May 20 '19 at 13:36
  • @Philippe Thanks, I just found and tried that command, and it worked - although I had to first add back the folder to the repo, and then for some reason run the `skip-worktree` command on each file inside the `.idea` folder. Simply running it on the folder seemed to work, but changes still showed up in `git status` and the IntelliJ commit dialog. I found the answer here useful: https://stackoverflow.com/a/40272289/930640 – Magnus May 20 '19 at 13:47

1 Answers1

2

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

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

Krantisinh
  • 1,579
  • 13
  • 16
  • 1
    Once again, bad use of ` assume-unchanged` (for perf). Should be `skip-worktree` (to ignore locally): https://stackoverflow.com/a/13631525/717372 I don't know why most people are wrong on most of the stackoverflow answers... – Philippe May 20 '19 at 13:38
  • Oh.. That's right. My bad! Updating the answer with correct info. – Krantisinh May 20 '19 at 13:45