Git remove untracked files

  • Run the following command to see which files or directories will be removed on a trial operation:
git clean -dn
// OR `git clean -d -n`
$ git clean -dn
Would remove app/src/main/assets/
  • If the output of the above command is what you've expected, run the below command to actually remove these files or directories:
git clean -df
// OR `git clean -d -f`
$ git clean -df
Removing app/src/main/assets/

There are other parameters for cmd git clean, which will remove ignored files, but normally we don't need it.

你可能感兴趣的:(Git remove untracked files)