Josh Dick portrait Josh Dick

Making Git a Little Fuzzier

A command-line wrapper for Git that does fuzzy filename matching.

As I wrote in a previous post, I constantly use Git on the command line. The command line is simply the fastest and easiest way for me to work with Git.

That said, one understandable aspect of working with Git on the command line is that file/directory paths must be explicitly specified. This means that while in the middle of typing a Git command, I often end up needing to do one or both of the following:

  • Move a hand from the keyboard to the mouse in order to select and copy a path from the output of git status, then return to the keyboard to paste the path

  • cd to a random directory (usually aggressively ramming the tab key) in order to either get git status to spit out a copyable path, or at least low enough into the directory tree to be able to have git <git command> . manipulate the desired path(s)

While neither of these take a long time, they’re both annoying.

After searching for tools to attack this problem and not finding anything that worked well for me, I decided to create git-fuzzy.

git-fuzzy simply wraps normal Git commands and (for now) assumes that its last argument should be a path that should be fuzzy-completed.

So, instead of having to do something like:

 git add another/very/long/path/myawesomefile.ext

git-fuzzy makes things pleasantly fuzzier:

 git fuzzy add awesome

The tool is tiny, basic and somewhat crude, but so far it gets the job done for me.

git-fuzzy is available on GitHub and is installable via npm.

If you end up using git-fuzzy, I’d love to hear your thoughts about it.