How to get tree -a to ignore .git directories?

Solution 1:

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

tree -a -I '.git'

Hope it helps.

Solution 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.