Repository maintenance and recovery. These commands help you free up space, remove untracked garbage, or recover lost commits.
git clean removes untracked files from your working directory. It's often used with -fdx to reset the repository to a pristine state (removing ignored build artifacts too). #nuke-untracked #purge #wipe #empty
git clean $clean_flagsGit automatically runs garbage collection occasionally, but you can force it to optimize your repository immediately. #optimize #compress #maintenance
git gc --prune=nowgit fsckThe reflog records every time your branch tips are updated (e.g., switching branches, rebasing, resetting). If you accidentally do a hard reset, you can find the lost commit hash here. #recover #lost-commits #history #rescue
git refloggit prune