malcoauri
malcoauri

Reputation: 12179

Can't remove from git nonexistent file

I typed 'git status' in console:

# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    app/controllers/api/v1/appication_controller.rb
#

I decided to remove this file:

git rm app/controllers/api/v1/application_controller.rb

But I got the following error:

fatal: pathspec 'app/controllers/api/v1/application_controller.rb' did not match any files

How can I fix it? Thanks.

Upvotes: 2

Views: 1708

Answers (1)

Amber
Amber

Reputation: 526493

git rm --cached app/controllers/api/v1/application_controller.rb

It's already removed from the disk, so you only have to remove it in the staging area to make Git recognize the removal.

Upvotes: 7

Related Questions