Skip to main content

A low-tech solution to large files in Git

Project description

RepoPacker

A low-tech solution to large files in Git

The problem

You're working on a project and you find yourself accumulating large files which are not well-suited for git leading you to add them to your .gitignore.

Months pass, and you find yourself wanting to share your repository including all of the large files which are now strewn about your repository and hidden from git.

At this point your options are limited to git-lfs (which now requires a paid subscription for truly large files) or linking to an external storage container outside of the repository which will often require refactoring.

Enter RepoPacker

RepoPacker is a command line tool built to work in harmony with Git to solve this problem. In a nutshell RepoPacker follows a simple workflow:

  1. You specify which files should be tracked by RepoPacker.
  2. RepoPacker collects tracked files and packs them into a standard zip file.
  3. When sharing the repository, the person downloading your code downloads both the repository and the zip file generated by RepoPacker.
  4. RepoPacker unpacks the zip file into the locations tracked by RepoPacker in your local repository.

The person downloading your code is left with a local git repository with the large files in their right place.

Installation

Installation requires git and python3.9+. Once you've installed the required dependencies you can install repopacker via pip:

pip install repopacker

Usage

Basic functionality

  • Add files: Add any large files / directories which you want tracked by RepoPacker:

    repopacker add largefile.txt
    repopacker add dir/
    

    This will create file named .repopacker.json at the GitHub root of your project. It contains some basic config information and will act as a storage container for RepoPacker.

    This command does two things:

    (1)largefile.txt and all the files in dir will be added into the list of RepoPacker tracked files.

    (2)largefile.txt and all the files in dir
    will be added to the .gitignore for your project (you can disable this behavior by setting the .gitignore flag in the .repopacker.json to false).

    Note: files tracked by RepoPacker will not have their changes tracked. All RepoPacker stores is a static link to the file.

  • Pack: Once you have added all the files you want tracked you can create a zip file,

    repopacker pack repopack.zip
    

    You should upload this to an accessible location such as dropbox or Zenodo. Optionally you can also add the link to the downloadpath in the .repopacker.json.

  • Unpack: Populate directories with large files in their original locations,

    repopacker unpack repopack.zip
    

Easy downloading

  • Setup: When running pack, RepoPack will store the hash for the pack in the .repopacker.json. You can setup a download link for your pack as,
repopacker config --downloadpath <your-download-link.zip>
  • Download: You can now automatically download the zip and unpack as usual:
repopacker download repopack.zip
repopacker unpack repopack.zip

Note this will download a zip file from the internet. RepoPacker performs a basic checksum using the SHA256 hash of the file but this does not guarantee the zip file's integrity. Only use this option with repositories you can trust.

Additional utilities

  • Initialize: From an existing git repository initialize the RepoPacker system without adding any files first.

    repopacker init
    

    This is useful if you want to setup some configuration options before adding any files.

  • List files: See all files currently tracked by repopacker:

    repopacker list
    
  • Remove files: If you accidentally add files to RepoPacker that you shouldn't have you can remove them:

    repopacker remove largefile.txt
    

    This will also remove largefile.txt from the .gitignore if you have the option enabled.

  • Configuration: See all configuration options:

    repopacker config -h
    
  • Clean: When downloading an updated version of the repopacker.zip, it can be useful to clear all prexisting files tracked by RepoPacker:

    repopacker clean
    

Gotchas

  • RepoPacker will attempt to zip your files into a single zip making it poorly suited to extremely large files (more than 100GB will probably become unwieldy).

  • To verify the integrity of zip files, RepoPacker will perform a checksum of the zipped file before unpacking. This can be slow for large zips. You can disable this behavior by modifying the config.

  • RepoPacker is not directly integrated with Git meaning any operations which update the file tree (like git mv) will not be known to RepoPacker. You must remove these files and re-add them using RepoPacker for them to be properly tracked.

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

repopacker-0.2.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

repopacker-0.2.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file repopacker-0.2.1.tar.gz.

File metadata

  • Download URL: repopacker-0.2.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.4.0

File hashes

Hashes for repopacker-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3fb17d6d3f939495066e2d8aeea85e550badbeda01a06639532a812973eb8ec5
MD5 d23be50918590737874b51ba4e405f85
BLAKE2b-256 e2fe64e8edc277206b3bf52cbf4059d333bc136ebafb574db0d204c3f4a06823

See more details on using hashes here.

File details

Details for the file repopacker-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: repopacker-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.4.0

File hashes

Hashes for repopacker-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b0804d0c3ed202ba9f54aa303da07fa63ef48a8ec49c39e6b9a0d4f5a4c9eae
MD5 e2a4bb7c3a39d93d79eecbbed4f4183f
BLAKE2b-256 86dd77c88c21828ff9fc700d62ce89c51e2d9580a6f5935a10b5822c6c0ace34

See more details on using hashes here.

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