The full process would look like this:
$ echo '.idea' >> .gitignore
$ git rm -r --cached .idea
$ git add .gitignore
$ git commit -m '(some message stating you added .idea to ignored entries)'
$ git push
参考:1.
http://stackoverflow.com/questions/11124053/accidentally-committed-idea-directory-files-into-git
Git: Remove a file from the repository without deleting it from the local filesystem