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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With