Daily Commands

Common commands for software engineers — organized by category. Click to copy when executable.

Dry run for clean

Preview files/dirs that would be removed.

git clean -n
gitcleandry-run

Remove untracked files

Force remove untracked files (no directories).

git clean -f
gitcleanfiles

Remove untracked files and directories

Force remove untracked files and directories.

git clean -fd
gitcleandirs

Override local with remote branch

Fetch and hard reset to remote branch; discards local changes/commits.

BRANCH=<branch>; git fetch origin $BRANCH && git reset --hard origin/$BRANCH && git clean -fd
gitresetremoteoverride

Override local with remote main branch

Fetch and hard reset to remote main branch; discards local changes/commits.

git fetch origin main && git reset --hard origin/main && git clean -fd
gitresetremoteoverridemain