More in Git
Amend a commit without changing its message
Git
Adds forgotten files to the previous commit and leaves the message exactly as it was.
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.
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.
Undo the last commit but keep the changes
Git
Moves HEAD back one commit and leaves everything staged, which is what you usually want after committing too early.
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.
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.
Random picks
Find what is taking up space in an image
Containers
Prints the size each layer adds, which usually points straight at the offending RUN line.
Call a JSON API from PowerShell
Networking
Invoke-RestMethod parses the response for you, so no ConvertFrom-Json step is needed.
RAII file handling in C++
Systems
The stream closes itself when it leaves scope, whether the function returns normally or throws.
Visually hidden, still read aloud
Web & CSS
Hides a label from sight while leaving it in the accessibility tree. display:none would remove it from both.
Inspect a TLS certificate from the command line
Networking
Prints the subject, issuer and validity dates without opening a browser.
Security headers for an Express app
Security
The handful worth setting even when you are not using a framework that sets them for you.
Parse arguments without a dependency
Python
argparse covers subcommands, types and help text, which is more than most scripts ever need.
Iterate and collect in Rust
Systems
Filter and map fuse into a single pass; collect decides what comes out the other end.