Git failing with a Filename too long fatal: Could not reset index file to revision 'HEAD

In this article I'll explain a simple way to fix the "Filename too long" error when using Git on Windows, which can be especially frustrating when it works fine on other platforms like macOS.