- Run
source setup.sh(or.\setup.ps1in PowerShell)
You are working on a project that involves generated files. Say you are compiling C files into object files. Before checking out a new branch you want to start clean
- Explore the directory with
ls -R. There is a lot going on. Code files, temp files, object files,.. Let's clean up! - Just to be safe, do a dry run and execute the clean command with the
-noption - Oh noes! there's a
.cfile that would have been deleted! - Add
src/mylib.cto the staging area. don't commit it. - Run the clean command with the
-noption. Notice that mylib.c will not be deleted. Also notice that the files in the obj directory are not listed - Run the clean command with the
-n -doption. - Looks good! clean the repo
-f -d
git clean -ngit addgit clean -n -dgit clean -f -d