When git fatal pathspec's you

Software

I've been trying to do more things the git way. Lately, I've been using git to perform file actions directly, rather than from the shell first then updating git's state. For example, using git rm will stop tracking a file, remove it from the repo and delete it locally:

$ git rm content/post/fate-stay-night.html

I'll admit, I'm still a little uncomfortable giving a tool this much power. But I balance this with the idea that I'm manipulating git's state to affect files rather than the reverse, which may be more resilient?

It did highlight a specific PEBKAC issue though:

git rm content/post/fate-stay-night.html
==> fatal: pathspec 'content/post/fate-stay-night.html' [..]

The file did exist, but I hadn't started tracking it. By removing the file normally, git was never made aware of its existance.

As an aside, I used to feel embarassed posting rudumentary discoveries like this, for fear trolls would laugh at me. Now, I don't give a shit. It's quite liberating :).

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!