Reputation: 11225
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?
Upvotes: 4
Views: 1184
Reputation: 1329572
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
Upvotes: 10