Skip to content

Instantly share code, notes, and snippets.

@Pk13055
Last active July 13, 2017 01:01
Show Gist options
  • Save Pk13055/60535d85f8e73ed4881b21ee5110229d to your computer and use it in GitHub Desktop.
Save Pk13055/60535d85f8e73ed4881b21ee5110229d to your computer and use it in GitHub Desktop.
Bash Script to make a git tree with links
#!/bin/bash
tree=$(tree -tf --noreport -I '*~' --charset ascii $1 |
sed -e 's/| \+/ /g' -e 's/[|`]-\+/ */g' -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g')
printf "# Project tree\n\n${tree}"
@Pk13055
Copy link
Author

Pk13055 commented Jul 13, 2017

How to run

  • chmod 755 git-tree.sh: Change permissions to make it executable
  • ./git-tree.sh <dir>: Display the tree for the given dir
  • ./git-tree.sh <dir> >> filename.md To append the tree to a given filename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment