Suppose that you've just done a git checkout -f to cleanup your local modifications.
New files added will slip out of the previous command, because they're treated by git as "untracked".
Here's a one-liner to get rid of these little fellas (requires a Ruby interpreter, because I <3 Ruby):
git status \
  --untracked-files=all \
  --no-column \
  --short | \
  rm $(ruby -e "puts STDIN.read.lines.map(&:split).map(&:last).join(' ')")
Update: as @kwstannard rightfully pointed out in the comments, there's also the prettier git-clean.
 


 
    
Top comments (2)
Nice! You may be interested in the git-clean command as well.
You're definitely right. I didn't know it existed. ^_^'