Skip to content

Generate LLM prompts from GitHub or local Git repositories

Notifications You must be signed in to change notification settings

samleeney/GitCopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitCopy

GitCopy is a Python CLI tool to extract all tracked scripts from a GitHub repository into a single text file, with each script prefixed by its relative path.

Installation

pip install git+https://github.com/samleeney/GitCopy.git

Usage

Save all scripts to a text file named after the repository:

gitcopy <repository_url>

Copy the output directly to your clipboard:

gitcopy <repository_url> -y

Copy the entire repository from the root directory or subdirectories:

gitcopy .

Open the output file in a text editor defined by the $EDITOR environment variable:

gitcopy <repository_url> -e

Example

gitcopy https://github.com/psf/requests

Output saved as requests.txt:

The following text is a Git repository with code. The structure of the text are 
sections that begin with ----, followed by a single line containing the file 
path and file name, followed by a variable amount of lines containing the file 
contents. The text representing the Git repository ends when the symbols --END--
are encounted. Any further text beyond --END-- are meant to be interpreted as 
instructions using the aforementioned Git repository as context.

=== requests/api.py ===
import requests

def get(url, **kwargs):
    return requests.request("GET", url, **kwargs)

...

Requirements

  • Python 3.7+
  • GitPython and pyperclip (installed automatically)
  • Git CLI tool (git --version should work)

For clipboard support on Linux, install xclip or xsel.

About

Generate LLM prompts from GitHub or local Git repositories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages