Git Error and File Rename

We use Git here to manage all file versioning, mostly because its awesome. However, every once in a while we get an error message that is too cryptic, even for us. We recently got this message while trying to commit a file:

pathspec: 'filename' git did not match any file(s) known to git

It took some googling and some introspection, but we finally figured it out. We had deleted the file, Foursquarelib.php and replaced it with foursquarelib.php. Do you see the subtle difference? When we deleted Foursquarelib.php, we forgot to tell Git about the removal. Using the trusty command line, we:

touch Foursquarelib.php

Then, in our Git client, we “removed” Foursquarelib.php and added/commited foursquarelib.php, and Git was so excited for us, it couldn’t contain itself. All is well. We hope this helps somebody, maybe even ourselves in the future.

Leave a Reply

Your email address will not be published. Required fields are marked *