Skip to main content

Gitree: git-aware project tree printing and zipping for docs and LLMs

Reason this release was yanked:

Unstable, broken zipping

Project description

Gitree

A git-aware CLI tool to provide LLM context for coding projects by combining project files into a single file with a number of different formats to choose from.

โœจ Features

Feature Description
๐Ÿ“Š Project Tree Visualization Generate clean directory trees with customizable depth and formatting
๐Ÿ—œ๏ธ Smart Zipping Create project archives that automatically respect .gitignore rules
๐ŸŽฏ Flexible Filtering Control what's shown with custom ignore patterns, depth limits, and item caps
๐Ÿ” Gitignore Integration Use .gitignore files at any depth level, or disable entirely when needed
๐Ÿ“‹ Multiple Output Formats Export to files, copy to clipboard, or display with emoji icons
๐Ÿ“ Directory-Only View Show just the folder structure without files for high-level overviews
๐Ÿ“ˆ Project Summary Display file and folder counts at each directory level with summary mode

๐Ÿ”ฅ The problems it solves:

  • sharing project structure in issues or pull requests
  • generating directory trees for documentation
  • pasting project layouts into LLMs
  • converting entire codebases to a single json file using .gitignore for prompting LLMs.

๐Ÿ“ฆ Installation

Run this command in your terminal:

# Install using pip
pip install gitree       

๐Ÿ’ก Usage

To use this tool, refer to this format:

gitree [path] [other CLI args/flags]

Open a terminal in any project and run:

# path should default to .
gitree                  

Example output:

Gitree
โ”œโ”€ gitree/
โ”‚  โ”œโ”€ constants/
โ”‚  โ”‚  โ”œโ”€ __init__.py
โ”‚  โ”‚  โ””โ”€ constant.py
โ”‚  โ”œโ”€ services/
โ”‚  โ”‚  โ”œโ”€ __init__.py
โ”‚  โ”‚  โ”œโ”€ draw_tree.py
โ”‚  โ”‚  โ”œโ”€ list_enteries.py
โ”‚  โ”‚  โ”œโ”€ parser.py
โ”‚  โ”‚  โ””โ”€ zip_project.py
โ”‚  โ”œโ”€ utilities/
โ”‚  โ”‚  โ”œโ”€ __init__.py
โ”‚  โ”‚  โ”œโ”€ gitignore.py
โ”‚  โ”‚  โ””โ”€ utils.py
โ”‚  โ”œโ”€ __init__.py
โ”‚  โ””โ”€ main.py
โ”œโ”€ CODE_OF_CONDUCT.md
โ”œโ”€ CONTRIBUTING.md
โ”œโ”€ LICENSE
โ”œโ”€ pyproject.toml
โ”œโ”€ README.md
โ”œโ”€ requirements.txt
โ””โ”€ SECURITY.md

Using emojis as file/directory icons:

gitree --emoji

Example output:

Gitree
โ”œโ”€ ๐Ÿ“‚ gitree/
โ”‚  โ”œโ”€ ๐Ÿ“‚ constants/
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ __init__.py
โ”‚  โ”‚  โ””โ”€ ๐Ÿ“„ constant.py
โ”‚  โ”œโ”€ ๐Ÿ“‚ services/
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ __init__.py
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ draw_tree.py
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ list_enteries.py
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ parser.py
โ”‚  โ”‚  โ””โ”€ ๐Ÿ“„ zip_project.py
โ”‚  โ”œโ”€ ๐Ÿ“‚ utilities/
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ __init__.py
โ”‚  โ”‚  โ”œโ”€ ๐Ÿ“„ gitignore.py
โ”‚  โ”‚  โ””โ”€ ๐Ÿ“„ utils.py
โ”‚  โ”œโ”€ ๐Ÿ“„ __init__.py
โ”‚  โ””โ”€ ๐Ÿ“„ main.py
โ”œโ”€ ๐Ÿ“„ CODE_OF_CONDUCT.md
โ”œโ”€ ๐Ÿ“„ CONTRIBUTING.md
โ”œโ”€ ๐Ÿ“„ LICENSE
โ”œโ”€ ๐Ÿ“„ pyproject.toml
โ”œโ”€ ๐Ÿ“„ README.md
โ”œโ”€ ๐Ÿ“„ requirements.txt
โ””โ”€ ๐Ÿ“„ SECURITY.md

For zipping a directory:

gitree --zip out

creates out.zip in the same directory.

Updating Gitree:

To update the tool, type:

pip install -U gitree

Pip will automatically replace the older version with the latest release.

โš™๏ธ CLI Arguments

In addition to the directory path, the following options are available:

Argument Description
--version, -v Displays the installed version.
--depth Limits recursion depth. Example: --depth 1 shows only top-level files and folders.
--all, -a Includes hidden files and directories. Does not override .gitignore.
--ignore Adds extra files or directories to ignore.
--ignore-depth Limits depth for --ignore patterns. Example: --ignore-depth 2 applies ignore rules only to first 2 levels.
--gitignore-depth Controls how deeply .gitignore files are discovered. Example: --gitignore-depth 0 uses only the root .gitignore.
--no-gitignore Ignores all .gitignore rules when set.
--max-items Limits items shown per directory. Extra items are summarized as ... and x more items. Default: 20.
--no-limit Removes the per-directory item limit.
--no-files Hide files from the tree (only show directories).
--emoji Show emojis in tree output.
--summary Print a summary of the number of files and folders at each level.
--zip [name], -z Zips the project while respecting .gitignore. Example: --zip a creates a.zip. If no name is provided, a random ID is used.
--out [file], -o Save tree structure to file. Example: --out tree.txt or --out tree.md for markdown format.
--copy, -c Copy tree output to clipboard.

Installation (for Contributors)

Clone the repository:

git clone https://github.com/ShahzaibAhmad05/Gitree

Move into the project directory:

cd Gitree

Install dependencies:

pip install -r requirements.txt

The tool is now available as a Python CLI on your system.

For running directly from main without installing:

python -m gitree.main

Contributions

This is YOUR tool. Issues and pull requests are welcome.

Gitree is kept intentionally small and readable, so contributions that preserve simplicity are especially appreciated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitree-0.2.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitree-0.2.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file gitree-0.2.0.tar.gz.

File metadata

  • Download URL: gitree-0.2.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gitree-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6fb88ab536554ffffc94062243bca8534f194954dfbbb5acf5da4f1baff2cabd
MD5 f3ae5a07420f88be84471118bcc412f6
BLAKE2b-256 14490f116496e63ffcf0130d6565bca4c4f55429249a470e5b5a090cadf2e563

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitree-0.2.0.tar.gz:

Publisher: workflow.yml on ShahzaibAhmad05/Gitree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitree-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gitree-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gitree-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a8a6e8e6cf71cd4265c71867dbae910af75fbb31516e27bc47d3366dd65982f
MD5 ce13cbfda71425fe8c3b49db46c9d5e9
BLAKE2b-256 b7d5f319bf74e6ea99bc3fdc8b18174dc3f69340d3f8a43b1cc4bc37f5e904d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitree-0.2.0-py3-none-any.whl:

Publisher: workflow.yml on ShahzaibAhmad05/Gitree

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page