18

I love using tree to list directories, and I have a git repository with all my dotfiles. For me to be able to see them I need to do tree -a, but that will also list the contents inside the .git directory, which most people (myself included) never dare touching.

How would I get tree -a to exclude only the .git directory?

26

You need to use the -I flag to exclude a pattern:

tree -a -I '.git'

Hope it helps.

1
  • 1
    For this particular use you can shorten it to tree -aI .git – Jon Bentley Mar 11 at 19:09
2

I wrote a node based clone of tree called tree-fiddy that honors gitignore settings. It's pretty alpha right now, but it's working fine on my machines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy