git clean – a nice addition to git reset

Anybody working with git is probably well familiar with the way to undo the non-committed changes:

git reset --hard

As useful as the above command is, it still leaves some room for improvement. The above command will only undo non-committed changes on the files that git is tracking. Often, this would leave a whole bunch of files and directories in place, which are not tracked by git. So far, I’ve been using a really complicated approach for removing them, which involves git status, grep, cut, xargs, and rm. Yuck.

Turns out there is a better way, which I found in “Stupid git tricks” article:

git clean -df .

This one will forcefully remove all untracked files and directories from the current directory. Combining these two commands together results in all non-committed changes being undone, no matter if they are on tracked files or not. Cool!

GRV – Git Repository Viewer

GRV is a text-based Git repository viewer for the console, much like tig, but with a few extra features:

  • Commits and refs can be filtered using a query language.
  • Changes to the repository are captured by monitoring the filesystem allowing the UI to be updated automatically.
  • Organised as tabs and splits. Custom tabs and splits can be created using any combination of views.
  • Vi like keybindings by default, key bindings can be customised.
  • Custom themes can be created.

Nerd Fonts – Iconic font aggregator, collection, and patcher

Nerd Fonts is a collection of fonts for people who work with code snippets, command line, and text-based user interface applications.  The fonts are also patched with additional popular icon sets like Font Awesome, Devicons, Octicons, and others.

MySQL optimize, repair, and analyze

Years ago I had the following script running as a cron job, but then I lost it somewhere.  It took me a few minutes to find it again, but just in case I need it in the future, I’m saving it here.

#!/bin/bash
mysqlcheck --all-databases
mysqlcheck --all-databases -o
mysqlcheck --all-databases --auto-repair
mysqlcheck --all-databases --analyze

Found it here this time.