Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to ignore .idea file via .gitignore

Tags:

git

gitignore

I pushed my code without putting .idea/ in .gitignore. But now when I realised it, I saw this SO answer. So when I tried to undo that commit/push using this SO answer, it works. But after adding .idea/* to .gitignore, and then doing git add and pushing the code, the .idea directory appears again and I can see all my previous commits(which I did undo).

What to do now?

like image 464
rahulserver Avatar asked Dec 26 '22 03:12

rahulserver


1 Answers

It appears again because you didn't ignore the .idea folder. You ignored the .idea folder content.

To ignore the whole folder, your .gitignore should contain:

.idea/

If the .idea folder remains, I would suggests removing it from the index (not from the disk with the --cached option) and pushing a new commit recording that deletion:

git rm --cached -r .idea/
git add -A .
git commit -m "Delete .idea"
git push
like image 122
VonC Avatar answered Jan 05 '23 17:01

VonC