Development
How to install Node.js on Ubuntu
Modern PHP sites still need Node.js to build their frontend assets. Here is how to install Node.js on Ubuntu with nvm, so you can switch versions per project without touching the system.
git stash pop vs apply: save and restore changes
git stash shelves your uncommitted changes so you can switch context. git stash pop restores them and removes the stash; git stash apply restores them but keeps the stash around.
npm ci vs npm install: when to use which
npm install resolves dependencies and updates your lockfile as it goes. npm ci does a clean, exact install straight from the lockfile, which is what you want in CI and production builds.
How to delete a local (and remote) Git branch
Deleting a branch locally uses git branch -d, with a capital -D to force it. Deleting it on the remote is a separate command that people often forget.
docker compose up: options and common flags
docker compose up reads your compose file and starts every service in it. The flags you reach for most are -d to run in the background and --build to rebuild images first.
How to checkout a Git tag
Checking out a tag puts you in a detached HEAD state, which is fine for inspecting a release but not for committing. If you want to make changes, create a branch from the tag.
What port does SSH use (and how to change it)
SSH uses TCP port 22 by default. You can change it in the SSH daemon config, but the port itself is not a security feature, so know what changing it does and does not buy you.
git reset --hard explained (soft vs mixed vs hard)
git reset moves your branch to another commit. The --soft, --mixed and --hard flags decide what happens to your staged and working changes, and --hard is the one that actually throws work away.
docker exec: run a command in a running container
docker exec runs a command inside a container that is already running. The classic use is opening an interactive shell with docker exec -it, but it is just as useful for one-off commands.
Fix: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
This error means your Docker client could not reach the Docker daemon. Either the daemon is not running, or your user does not have permission to talk to its socket.
How to rename a Git branch (local and remote)
Renaming a branch locally is one command. The part people miss is updating the remote: Git cannot rename a remote branch directly, so you push the new name and delete the old one.
How to remove untracked files in Git (git clean)
git clean deletes untracked files from your working directory. Always dry-run it first with -n, because unlike most Git operations these deletions cannot be undone.
How to clean up Docker with prune (images, volumes, system)
Docker hangs on to stopped containers, unused images and dangling volumes, which quietly eat disk space. The prune commands clean them up, but a couple of flags decide how aggressive that cleanup is.