In this tutorial you will lean how to use the Git clean command in order to remove untracked files from the working tree.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# Git clean command # Remove untracked files from the working tree touch tmp-1.txt touch tmp-2.txt touch tmp-3.txt git status git clean # -n Don’t actually remove anything, just show what would be done git clean -n git add tmp-1.txt git clean -n # -f --force git clean -f git status git reset HEAD tmp-1.txt git status git clean -f git status # Man page man git-clean |