QuickSnip

Language: Bash

Undo a git commit while keeping your changes staged.

# Undo the last commit but keep the changes staged
git reset --soft HEAD~1

# Or undo and unstage the changes (working tree preserved)
git reset HEAD~1
Updated Jul 17, 2026

Iterate over matching files and run a command on each.

#!/usr/bin/env bash
set -euo pipefail

for file in src/**/*.ts; do
  echo "Processing $file"
  npx prettier --write "$file"
done
Updated Jul 17, 2026