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.
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.
List branches merged into main
Git
Finds the branches that are safe to delete, and the ones that are not.
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.
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.
Stop tracking a file without deleting it
Git
For the config file that should never have been committed. Add it to .gitignore afterwards.
Random picks
Inspect a TLS certificate from the command line
Networking
Prints the subject, issuer and validity dates without opening a browser.
Shell into a running container
Containers
Falls back to sh, since slim images often have no bash.
Show which process is holding a port
Shell
Answers 'address already in use' without guessing.
An RSS feed skeleton
Data Formats
The minimum a reader needs. Dates must be RFC 822, which is the part most generators get wrong.
Reset a Postgres sequence after a bulk import
Databases
Copying rows with explicit ids leaves the identity sequence behind, so the next insert collides with an existing row.
Throttle with a trailing call
JavaScript
Runs at most once per interval but still fires once more after the last event, so the final state is never dropped.
Rewrite a CSV column with perl
Text Processing
A one-liner that upper-cases the second field of every row, leaving the rest alone.
Extract matches with a regular expression
Text Processing
grep -o prints only the matching part, which turns grep into a crude extractor.