8

From time to time I have untracked files in my git repository and I'd like to delete them.

Is there an easy way to do so using git or bash or even another way?

thitemple
  • 5,833
  • 4
  • 42
  • 67

1 Answers1

3

Use git clean command.

git clean -f -d # will delete all untracked directories and files.
hspandher
  • 15,934
  • 2
  • 32
  • 45
  • duplicated question: see https://stackoverflow.com/questions/61212/how-to-remove-local-untracked-files-from-the-current-git-working-tree?rq=1 – elhadi dp ıpɐɥןǝ Jun 27 '17 at 13:13
  • 2
    That is still no reason for downvoting the answer. It's the job of OP to make sure that the question is not already asked. – hspandher Jun 27 '17 at 13:15