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.
List branches merged into main
Git
Finds the branches that are safe to delete, and the ones that are not.
Amend a commit without changing its message
Git
Adds forgotten files to the previous commit and leaves the message exactly as it was.
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.
Stop tracking a file without deleting it
Git
For the config file that should never have been committed. Add it to .gitignore afterwards.
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.
Random picks
Which DNS records does a domain have?
Networking
dig with +short strips everything but the answer.
Responsive grid without media queries
Web & CSS
auto-fill with minmax reflows on its own, so the column count follows the container rather than a breakpoint list.
Watch a command until it succeeds
Shell
Retries every two seconds and stops the moment the command exits zero. Useful while waiting for a service to come up.
Find the largest files with PowerShell
Shell
The Windows counterpart to du | sort | head.
Parse arguments without a dependency
Python
argparse covers subcommands, types and help text, which is more than most scripts ever need.
Format a number as currency
JavaScript
Intl handles the symbol, the separators and the decimal places for the locale, so you never hand-roll them.
Time every phase of an HTTP request
Networking
Splits DNS, connect, TLS and first byte apart, which tells you which one is actually slow.
Iterate and collect in Rust
Systems
Filter and map fuse into a single pass; collect decides what comes out the other end.