0

I have a following case:

I made a .gitignore on gitignore.io. The .idea folder and project_name.iml were not in the ignore list and were pushed into the repo. I added them into the .gitignore, but they remain in the repo. If I make any changes to them, they appear in the list of changed files to commit. There is a way to get rid of them through the terminal

git rm -r --cached .idea/

But is it possible to start ignoring changes in those files and remove them from the repo by the IDE without using terminal?

torek
  • 448,244
  • 59
  • 642
  • 775
Kosh
  • 960
  • 2
  • 13
  • 28
  • 1
    You need to first remove them from the repo and commit, after which point the .gitignore will start working as you want. – joanis Apr 03 '22 at 18:11
  • Does this answer your question? [Gitignore not working](https://stackoverflow.com/questions/25436312/gitignore-not-working) – joanis Apr 03 '22 at 18:12
  • (To get an IDE-specific answer, avoid the generic [tag:git] tag.) – torek Apr 03 '22 at 23:21

1 Answers1

2
  1. Remove the file/folder in Project tool window via the "del" key:
  2. Invoke "Undo" action to get them back. You will be asked if you want to add the files to git.
  3. Click "NO"
  4. Commit changes. The removed/re-added folder will be removed from git in the scope of this commit.

Here is the short video demonstrating the process: enter image description here

Konstantin Annikov
  • 11,655
  • 4
  • 27
  • 40