git-partial-submodule is a command-line script for setting up and working with submodules while enabling them to use git's partial clone and sparse checkout features.

Overview

Partial Submodules for Git

git-partial-submodule is a command-line script for setting up and working with submodules while enabling them to use git's partial clone and sparse checkout features.

In top-level repositories, git provides various partial-clone options such as "blobless" clone, which reduce the burden of downloading large repositories. For submodules, only "shallow" clones are supported by git, but shallow clones have usability issues that make the resulting repo difficult to work with. git-partial-submodule clones your submodules as blobless repos, leaving them fully functional while saving bandwidth and disk space compared to a full clone.

Similarly, top-level repositories support sparse checkout, which lets you cut down the worktree to just the files you're interested in. This is particularly relevant for submodules, as their repositories often contain extra contents such as tests, examples, ancillary tools, and suchlike that we don't need if we just want to use the submodule as a library in our project. git-partial-submodule stores sparse checkout patterns in .gitmodules, so they can be managed under version control and automatically applied when the submodules are cloned.

Prerequisites

  • git 2.27.0 or later
  • Python 3.8 or later

Installation

git-partial-submodule is a single-file Python script. Download the script and put it somewhere in your PATH, or add it to your repository. Or add this repository as a submodule.

Usage

git-partial-submodule.py add [-b BRANCH] [--name NAME] [--sparse] 
   
    
    
    
     
     
git-partial-submodule.py clone [
     
     
      
      ...]
git-partial-submodule.py save-sparse [
      
      
       
       ...]
git-partial-submodule.py restore-sparse [
       
       
         ...] 
       
      
      
     
     
    
    
   
   

Add

Creates and clones a new submodule, much like git submodule add, but performs a blobless clone. If --sparse is specified, also enables sparse checkout on the new submodule, with the default pattern set of /* !/*/.

Clone

Use this to initialize submodules after a fresh clone of the superproject. Performs blobless clones of any submodules that are not already cloned. Also applies any sparse checkout patterns specified in .gitmodules.

Save-Sparse

After making changes to the sparse patterns in a submodule, use this to save them to .gitmodules. Patterns are stored space-delimited in the sparse-checkout property.

Restore-Sparse

Reapplies the sparse patterns saved in .gitmodules to the actual submodules. Use this after pulling or switching branches, etc.

Limitations and Cautions

Partial clone and sparse checkout are both still experimental git features that may have sharp edges.

This tool works by fiddling with the internals of your repository in not-officially-supported ways, so it might fail or do the wrong thing in some edge cases I haven't considered (and might leave your repo in a bad state afterward).

Not all of the various command-line options to the underlying git clone, git submodule add, etc. are supported. In particular, recursive clone is not currently supported.

"Cone" mode for sparse checkout is not currently supported.

Spaces in sparse checkout patterns are not currently handled correctly.

Owner
Nathan Reed
3D rendering at Adobe; formerly at 343, Sucker Punch, and NVIDIA. Math & coding blog writer, sometime musician, sci-fi & physics nerd. He/him.
Nathan Reed
A command line utility for tracking a stock market portfolio. Primarily featuring high resolution braille graphs.

A command line stock market / portfolio tracker originally insipred by Ericm's Stonks program, featuring unicode for incredibly high detailed graphs even in a terminal.

Conrad Selig 51 Nov 29, 2022
open a remote repo locally quickly

A command line tool to peek a remote repo hosted on github or gitlab locally and view it in your favorite editor. The tool handles cleanup of the repo once you exit your editor.

Rahul Nair 44 Dec 16, 2022
A CLI for advanced management of your notes with simple commands

PyNoteManager This is a CLI for advanced management of your notes with simple co

3 Dec 30, 2021
A handy command-line utility for generating and sending iCalendar events

A handy command-line utility for generating and sending iCalendar events This simple command-line utility is designed to generate an iCalendar event,

Baochun Li 17 Nov 21, 2022
WazirX Portfolio Tracker on your Terminal!

If you have been investing in crypto in India, there is a very good chance that you are using WazirX. If you are using WazirX, then you definitely know that there is no P&L report, no green arrows no

Raunit 15 Jan 10, 2022
An question and answer shell environment based on xonsh using ansible for setup

An question and answer shell environment based on xonsh using ansible for setup

Steven Hollingsworth 2 Jan 11, 2022
Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime

Oil is a new Unix shell. It's our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!

2.4k Jan 08, 2023
A useful and easy to use Terminal Timer made with Python.

Terminal SpeedCubeTimer Installation ยกNo requirements! Just Download and play Usage Starts timer.py and you will see this. python timer.py Scramble

Achalogy 5 Dec 22, 2022
Phishing-Detective is a command line application for Windows 10 built to detect a phishing site from two url's

Phishing-Detective Phishing-Detective is a command line application for Windows 10 built to detect a phishing site from two url's How it works A simpl

2 Jun 23, 2022
spotifytools is a Python command line tool

spotifytools spotifytools is a Python command line tool Documentation The documentation is available on the following link Releases Instalation instru

0 Sep 28, 2021
Access hacksec.in from your command-line

Access hacksec.in from your command-line

hacksec.in 3 Oct 26, 2022
Wik is use to get information about anything on the shell using Wikipedia.

WIK wik is a tool to view wikipedia pages from your terminal. It also let you search for any wikipedia up to date article on one query from your termi

Yash Singh 340 Dec 18, 2022
CLI utility to search and download torrents from major torrent sites

CLI Torrent Downloader About CLI Torrent Downloader provides convenient and quick way to search torrent magnet links (and to run associated torrent cl

x0r0x 86 Dec 19, 2022
โš™ A lightweight command line interface library for creating commands.

โš™ A lightweight command line interface library for creating cli commands. About | Installation | Usage | Features | Contributors | License About Next:

Serum 16 Sep 25, 2022
๐Ÿ”– Lemnos: A simple, light-weight command-line to-do list manager.

๐Ÿ”– Lemnos: CLI To-do List Manager This is a simple program that allows one to manage a to-do list via the command-line. Example $ python3 todo.py add

Rohan Sikand 1 Dec 07, 2022
A CLI framework based on asyncio

asynccli A CLI framework based on asyncio. Note This is still in active development. Things will change. For now, the basic framework is operational.

Adam Hopkins 6 Nov 13, 2022
Program Command Line Interface (CLI) Sederhana: Pemesanan Nasi Goreng Hekel

Program ini merupakan aplikasi yang berjalan di dalam command line (terminal). Program ini menggunakan built-in library python yaitu argparse yang dapat menerima parameter saat program ini dijalankan

Habib Abdurrasyid 5 Nov 19, 2021
A super simple terminal command shortener ๐ŸŸ

pcmd A super simple terminal command shortener ๐ŸŸ Source code : https://github.com/j0fiN/pcmd Documentation : https://j0fin.github.io/pcmd About Durin

9 Mar 02, 2022
This CLI give the possibility to do a queries in Star Wars API and returns a JSON in a terminal.

Star Wars CLI (swcli) This CLI give the possibility to do a queries in Star Wars API and returns a JSON in a terminal. Install $ pip install swcli Qu

Pery Lemke 5 Nov 05, 2021
CLI Web-CAT interface for people who use VIM.

CLI Web-CAT CLI Web-CAT interface. Installation git clone https://github.com/phuang1024/cliwebcat cd cliwebcat python setup.py bdist_wheel sdist cd di

Patrick 4 Apr 11, 2022