More in Git
Find the commit that introduced a bug
Git
Binary search across history. Mark a known good and a known bad commit and git narrows it down for you.
Recover a branch you deleted
Git
The reflog remembers where HEAD has been for about ninety days, so a deleted branch is almost never really gone.
Stop tracking a file without deleting it
Git
For the config file that should never have been committed. Add it to .gitignore afterwards.
List branches merged into main
Git
Finds the branches that are safe to delete, and the ones that are not.
Search the whole history for a string
Git
Finds every commit whose diff added or removed a piece of text, including in files long since deleted.
Show what a merge will do before doing it
Git
Lists the commits and the files a merge would bring in, so a surprise is less likely.
Amend a commit without changing its message
Git
Adds forgotten files to the previous commit and leaves the message exactly as it was.
Random picks
Walk a directory tree lazily
Python
pathlib keeps the paths as objects rather than strings, so joining and suffix checks stay readable.
Respect a reduced-motion preference
Web & CSS
One rule that disables animation for people who asked their system for less of it.
A README that people actually read
Data Formats
The order matters more than the length: what it is, how to run it, how to develop on it.
Serve the current directory over HTTP
Shell
Three ways to put a folder on localhost when you need to test something quickly.
A GitHub Actions workflow for a Node project
Build & CI
Caches the dependency install, runs on a matrix of versions, and fails the build on a lint error.
Find slow queries in Postgres
Databases
Ranks statements by total time spent. Needs the pg_stat_statements extension enabled.
Pin a dependency to an exact version
Build & CI
Caret ranges are how a build that passed last week fails today. Exact versions plus a lockfile remove the surprise.
Check a file's checksum
Security
Verifies a download actually matches what the publisher signed, rather than trusting the transfer.