Last active
January 21, 2019 00:22
-
-
Save pyliaorachel/3221865484666d234c4bc43959a82ce4 to your computer and use it in GitHub Desktop.
Command to display directory tree structure ignoring everything in .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tested on AWS EC2 Linux | |
| # tree -I '<pattern-to-ignore>' -> display tree | |
| # grep -o '^[^#]*' .gitignore -> remove comments in .gitignore | |
| # | sed 's/\/$//g' -> replace trailing '/' after directories | |
| # | tr '\n' '|' -> join strings with '|' | |
| tree -I $(grep -o '^[^#]*' .gitignore | sed 's/\/$//g' | tr '\n' '|') | |
| # Tested on MacOSX | |
| # tree -I '<pattern-to-ignore>' -> display tree | |
| # grep -o '^[^#]*' .gitignore -> remove comments in .gitignore | |
| # | sed 's/\/$//g' -> replace trailing '/' after directories | |
| # | sed '/^$/d' -> delete newlines | |
| # | tr '\n' '|' -> join strings with '|' | |
| # | sed 's/|$//g' -> remove the last '|' | |
| tree -I $(grep -o '^[^#]*' .gitignore | sed 's/\/$//g' | sed '/^$/d' | tr '\n' '|' | sed 's/|$//g') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment