Skip to content

Cheat Sheet

  1. Get the files affected by a commit.
  2. Run ripgrep on these files.
git diff-tree --no-commit-id -r --name-only -z {{commit-hash}} | xargs -0 rg "search-term"

Move Files

Move Files One Level Up

Get-ChildItem -Path . -Directory | ForEach-Object { Get-ChildItem -Path $_.FullName | Move-Item -Destination . }
setopt dotglob nullglob; for dir in */; do [ -d "$dir" ] && mv -- "$dir"* . 2>/dev/null; done; unsetopt dotglob nullglob
shopt -s dotglob nullglob; for dir in */; do [ -d "$dir" ] && mv -- "$dir"* . 2>/dev/null; done; shopt -u dotglob nullglob

Move Files One Level Up && Delete Empty Folders

Get-ChildItem -Path . -Directory | ForEach-Object { Get-ChildItem -Path $_.FullName | Move-Item -Destination .; Remove-Item -LiteralPath $_.FullName }
setopt dotglob nullglob; for dir in */; do [ -d "$dir" ] && mv -- "$dir"* . 2>/dev/null && rmdir -- "$dir"; done; unsetopt dotglob nullglob
shopt -s dotglob nullglob; for dir in */; do [ -d "$dir" ] && mv -- "$dir"* . 2>/dev/null && rmdir -- "$dir"; done; shopt -u dotglob nullglob