23.1. Removing untracked files
If you have untracked files in your working tree which you want to remove, you can use the
git clean
command.
Be careful with this command. All untracked files are removed if you run this command. You will not be able to restore them, as they are not part of your Git repository.
|
23.2. Example: Using git clean
The following commands demonstrate the usage of the
git clean
command.# create a new file with content
echo "this is trash to be deleted" > test04
# make a dry-run to see what would happen
# -n is the same as --dry-run
git clean -n
# delete, -f is required if
# variable clean.requireForce is not set to false
git clean -f
# use -d flag to delete new directories
# use -x to delete hidden files, e.g., ".example"
git clean -fdx
0 comments:
Post a Comment