Reputation: 50362
Using PyCharm to commit to git. After going through the dialogs to commit, t I keep getting this error:
error: 'static/static/js/backbone_objects/router.js' has local modifications (use --cached to keep the file, or -f to force removal)
The problem is that I'm using PyCharm's interface to do this, so as far as I know, I cannpt add those commands to the git commit
command.
What is a good way to handle this situation?
Thanks so much!
Upvotes: 1
Views: 1990
Reputation: 3855
Most probably, the situation that happened is the following:
The latter command produced the error. By this message Git warns you that you are about to delete a file, which you have not only changed, but even have staged the changes.
To solve the problem just call git rm -f <file>
from the command line.
The reason why PyCharm doesn't handle this situation properly is because it doesn't understand Git staging area in the implementation. Feel free to vote for IDEA-63391 (general problem) and IDEA-85948 (probably the same issue as you've faced).
Btw, my version of Git reports a more clear message, so you must be using some older one:
error: 'dir with spaces/newfile.txt' has changes staged in the index
(use --cached to keep the file, or -f to force removal)
Upvotes: 7