Tool for converting the contents of a git repository to a single markdown file that can be used in an LLM prompt.
Project description
git2prompt
git2prompt is a command-line utility that converts a local Git repository into a formatted text representation. This can be useful for sharing code snippets, project structures, or entire repositories in a plain text format, without needing to archive or transmit the actual files.
Installation
pip install git2prompt --user
Usage
To use git2prompt, simply run the git2prompt
script and provide the path to the Git repository you want to convert:
git2prompt /path/to/your/repo
This will output the formatted text representation of the repository to the console.
Output Format
The output follows this structure: The text represents a Git repository with the following format:
filename: The name of the file, within a repository format: The format of the file contents The repository ends with --END--
Any text after --END-- are instructions related to the repository.
Copy code
Each file in the repository is represented as a block, with the filename, file format, and contents included. The supported file formats are:
- Text files (
.txt
) - Markdown files (
.md
) - HTML files (
.html
) - Python scripts (
.py
)
After all file blocks, the output ends with --END--
. Any text after this line is considered instructions related to the repository.
Ignored Files
git2prompt respects .gitignore
files in the repository. Any files or directories listed in these ignore files will be excluded from the output.
Example
Running python -m git2prompt /path/to/your/repo
with the provided example repository will output:
```
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file git2prompt-0.1.0.tar.gz
.
File metadata
- Download URL: git2prompt-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61c1898870284e9e632b20c33429b094ff9ba9db02826059d4f89d1352d30438 |
|
MD5 | 7058afd9ecc1d544abc7d177ad1861c8 |
|
BLAKE2b-256 | 1c11096083c6896e28def50ab3e9a7b8d2b5e01a3c69b8164f37603cf38ef2fe |
File details
Details for the file git2prompt-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: git2prompt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d6058997a9657adc5e297238c01d5a2d02c1788be08d58e5ce20634ad26cd4 |
|
MD5 | 99df8c4dccf27522fbf08a51cf671ab0 |
|
BLAKE2b-256 | eb937ded1d0d4a30f682309ae008c2113d47c3fdeeb565d4bc6fc1fdc4aab0ce |