- Run
source setup.sh
(or.\setup.ps1
in 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
-n
option - Oh noes! there's a
.c
file that would have been deleted! - Add
src/mylib.c
to the staging area. don't commit it. - Run the clean command with the
-n
option. 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 -d
option. - Looks good! clean the repo
-f -d
git clean -n
git add
git clean -n -d
git clean -f -d