How to make files removed using git rm behave correctly in PyCharm?

I've seen on the threads here that PyCharm git integration does not offer a 'Remove' command so you have to remove files from outside the IDE (or in terminal window) and then re-add and commit them.

However, I'm getting errors in the workflow when trying to commit/push to GitHub and I'm unclear what I'm doing wrong. Here's what I've done:

  1. Got error from trying to push a large (> 200MB) file to GitHub via IDE
  2. outside of the IDE, did git rm --cached <filename> to remove the file from the repository but leave it in the filesystem. This works fine.
  3. IDE updates: filename in project view goes from white (committed) to red (untracked)
  4. tried doing an Add within the IDE, and the file gets re-staged for commit, turns white again
  5. committing and pushing directory causes original error

So, I tried everything outside the IDE:

  1. did git rm --cached <filename> and again IDE updates
  2. outside IDE did git commit -a -m "message"
  3. commit succeeds

Then, I edited another file in the IDE and tried committing/pushing it. The original error (file too big from GitHub) came back saying that the original huge file was in the commit/push.

I don't get it.

How exactly are you supposed to:

  1. remove a file you added by mistake to git in the IDE from the repository
  2. have the changes actually reflected in the IDE
  3. be able to push that change to GitHub (or another remote I guess)

Please sign in to leave a comment.