{"id":13514649,"url":"https://github.com/b1f6c1c4/git-get","last_synced_at":"2025-03-24T14:32:49.696Z","repository":{"id":47961015,"uuid":"253944550","full_name":"b1f6c1c4/git-get","owner":"b1f6c1c4","description":"Blazingly fast git clone alternative","archived":false,"fork":false,"pushed_at":"2023-11-02T15:45:03.000Z","size":289,"stargazers_count":41,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T03:55:17.118Z","etag":null,"topics":["git","git-clone","git-clone-partial","git-shallow-clone"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b1f6c1c4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-04-08T00:29:26.000Z","updated_at":"2025-02-20T10:59:35.000Z","dependencies_parsed_at":"2023-01-23T02:46:02.445Z","dependency_job_id":"509611bd-3f3f-413a-a6f2-b16aa8ee5538","html_url":"https://github.com/b1f6c1c4/git-get","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1f6c1c4%2Fgit-get","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1f6c1c4%2Fgit-get/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1f6c1c4%2Fgit-get/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b1f6c1c4%2Fgit-get/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b1f6c1c4","download_url":"https://codeload.github.com/b1f6c1c4/git-get/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245289799,"owners_count":20591134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","git-clone","git-clone-partial","git-shallow-clone"],"created_at":"2024-08-01T05:00:59.713Z","updated_at":"2025-03-24T14:32:49.352Z","avatar_url":"https://github.com/b1f6c1c4.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# `git-get`: Blazingly fast, incredibly handy `git clone`\n\n[![Appveyor](https://img.shields.io/appveyor/build/b1f6c1c4/git-get?style=flat-square)](https://ci.appveyor.com/project/b1f6c1c4/git-get/build/master)\n[![Coveralls](https://img.shields.io/coveralls/github/b1f6c1c4/git-get?style=flat-square)](https://coveralls.io/github/b1f6c1c4/git-get)\n\n- ✅ Automatic shallow clone\n- ✅ Automatic partial clone\n- ✅ Single file/directory clone, even crossing submodule boundaries\n- ✅ Arbitrary clone given commit SHA1\n- ✅ Fast parallel submodules clone\n- ✅ Interactive submodules clone selection\n- ✅ Full `git sparse-checkout` support\n- ✅ Optional single branch/tag clone\n- ✅ Tag file `VERSION`\n- ✅ Automatic origin + upstream clone (for GitHub only)\n\n## TL;DR\n\n- Download a file:\n    ```bash\n    # Method 1: Paste the original URL into the terminal:\n    git get https://github.com/b1f6c1c4/git-get/blob/master/README.md\n    # Method 2: Of course, a full URL is acceptable:\n    git get git@github.com:b1f6c1c4/git-get.git -- README.md\n    # Method 3a: Type a few words in the terminal:\n    git get b1f6c1c4/git-get -- README.md\n    # Method 3b: If the above doesn't work because of SSH, use HTTPS:\n    git get -H b1f6c1c4/git-get -- README.md\n    ```\n- Download a folder:\n    ```bash\n    # The same as before:\n    git get https://github.com/b1f6c1c4/git-get/tree/master/tests\n    git get b1f6c1c4/git-get -- tests\n    # Optionally, you may want a VERSION file to record the commit SHA1:\n    git get -t ...\n    ```\n- Download a repo:\n    ```bash\n    git get[s] [-X|-Y] https://github.com/b1f6c1c4/git-get\n    git get[s] [-X|-Y] https://github.com/b1f6c1c4/git-get/tree/example-repo2\n    git get[s] [-X|-Y] https://github.com/b1f6c1c4/git-get/commit/2dd50b6\n    git get[s] [-X|-Y] b1f6c1c4/git-get\n    git get[s] [-X|-Y] b1f6c1c4/git-get example-repo2\n    git get[s] [-X|-Y] b1f6c1c4/git-get 2dd50b6\n    ```\n    - __`s`__ to include submodules\n    - Depending on the scenario, use __one__ of the following:\n        - __`-X`__: clone a repo and make changes\n        - __`-Y`__: download a repo to compile it\n- You already have a cloned repo, and you want its submodules:\n    ```bash\n    git gets              # Just give me all\n    git gets -c           # Let me choose\n    git gets --no-init    # Only those with 'git submodule init ...'\n    ```\n\n## Performance\n\n```bash\ngit get \u003curl\u003e -t\n# is 1x~10000x faster than:\n#     git clone \u003curl\u003e repo\n#     git -C repo rev-parse HEAD \u003e repo/VERSION\n#     rm -rf repo/.git\n\ngit get \u003curl\u003e -o \u003coutput-file\u003e -- \u003cfile\u003e\n# is 1x~1000000x faster than:\n#     git clone \u003curl\u003e repo\n#     git -C repo submodule update --init --recursive\n#     cp repo/\u003cfile\u003e \u003coutput-file\u003e \u0026\u0026 rm -rf repo\n\ngit get \u003curl\u003e \u003ccommit\u003e -- \u003cfile\u003e\n# is 1x~1000000000x faster than:\n#     git clone --mirror \u003curl\u003e repo\n#     git -C repo switch --detach \u003ccommit\u003e\n#     rm -rf repo/.git\n\ngit gets \u003curl\u003e \u003ccommit\u003e -P\n# is 1x~10000000x faster than:\n#     git clone --mirror \u003curl\u003e repo\n#     git -C repo switch --detach \u003ccommit\u003e\n#     git -C repo submodule update --init --recursive\n#     rm -rf repo/**/.git\n\n# If you already have a repo and want to inflate all its submodules:\ngit gets\n# is 1x~10000000x faster than (and 8x shorter to type):\n#     git submodule update --init --recursive\n```\n\n## Why we need it, and why is it so fast?\n\n### A brief but lengthened story of `git clone` performance\n\nSo many times we want to download something hosted on GitHub.\nWhat we actually want is a complete working copy of the code and configurations,\nwithout any development history or irrelavent informations.\nOnce upon a time, there were only two ways to retrieve data from git/GitHub:\n\n1. Simply call `git clone`.\nWell, by default `git` downloads the entire development history.\nSome huge projects can have 100,000 commits, each with 1GiB files.\nEven though there are some duplicated files that saves some space,\nthis is **totally undesirable unless you are one of the developer**.\n\n1. On GitHub, click `Clone or download`/`Download ZIP`.\nOK, now we only have what we want downloaded.\nBut is that complete? What about `git submodule`s?\nSome huge projects can have more than 30 nested submodules.\nAre you willing to download one by another with your own hands?\nThis is **only applicable if there is no or very few submodules**.\n\n1. On GitHub, click `Raw` button when displaying a file.\nOK, but it only works for a single file.\nAre you willing to download one by another with your own hands?\nThis is **only applicable if you need up to a few files**.\n\nSome time later, `git` has improved.\n\n1. We now have `git clone --depth=1`: to clone the very first commit of a branch.\nBut some problems also arose:\nWe cannot get a specific commit buried inside the development history.\nThis may not be a problem for big matured project where there\npeople only need to look for its tags and branches.\nHowever, we frequently need to retrieve a specified version of a repo,\nespecially when we are using `git submodule`.\nLong words short, `--depth=1` works well for the parent repo,\nbut dysfunctions so frequently when working with submodules.\n\nAnd even later, in 2018, `git` improved again.\n\n1. We now have `git clone --filter tree:0`: to clone commits eagerly but files lazily.\nThat's a great improvement!\nBut GitHub hadn't been offering support for `--filter` until 2019.\nSo, now, we have all the tools necessary to download whatever you what from GitHub!\n\n### Benefits of using `git-get`\n\n1. It leverages both `--depth` and `--filter` to save bandwidth.\nOnly the files you actually want (that commit that file) are downloaded.\nNo entire development history.\nNo entire repository folder.\nRemember, this applies to the parent repo as well as all sub repos.\n1. It handles `git submodule`s very well.\nJust tell `git-get` the path of your file with respect to the parent repo.\n`git-get` will recursively scan through the submodule chain and grab the file for you.\n1. It handles optional dependencies also pretty well:\nSome project specifies optional dependencies as submodules.\nIf you want to download some submodules but not the others,\njust add `-c|--confirm` to `git-gets` and you can\ninteractively choose which dependency you want to install.\n\n## Basic Usage\n\nThe CLI is pretty self-explanatory:\n\n```bash\n# There are multiple ways to specify what you want to download:\n\u003cspecifier\u003e :=\n    \u003cfull-url-to-git-location\u003e\n    | \u003cuser\u003e/\u003crepo\u003e [\u003cbranch\u003e|\u003csha1\u003e]\n    | https://github.com/\u003cuser\u003e/\u003crepo\u003e/\n    | https://github.com/\u003cuser\u003e/\u003crepo\u003e/commit/\u003ccommitish\u003e\n    | https://github.com/\u003cuser\u003e/\u003crepo\u003e/tree/\u003ccommitish\u003e[/\u003cpath\u003e]\n    | https://github.com/\u003cuser\u003e/\u003crepo\u003e/blob/\u003ccommitish\u003e[/\u003cpath\u003e]\n\n# Download a single repo (or part of):\ngit-get [-v|--verbose|-q|--quiet] [-s|--ssh | -H|--https] [-X|-Y]\n    \u003cspecifier\u003e [-o \u003ctarget\u003e] [-f|--force] [-F|--rm-rf]\n    (-x [-B] [-T] | [-t|--tag] [-- [\u003cpath\u003e]])\n\n# Download a repo and its submodules:\ngit gets [-v|--verbose|-q|--quiet] [-s|--ssh | -H|--https] [-X|-Y]\n    [-P|--parallel] [-c|--confirm] [--no-recursive]\n    \u003cspecifier\u003e [-o \u003ctarget\u003e] [-F|--rm-rf]\n    (-x [-B] [-T] | [-t|--tag])\n\n# Download submodules of an existing repo:\ngit gets [-v|--verbose|-q|--quiet] [-s|--ssh | -H|--https] [-X|-Y]\n    [-P|--parallel] [-c|--confirm] [--no-recursive] [--no-init]\n```\n\nSome comments:\n\n* `-X`=`-xuBTP` for keep repo and make changes; `-Y`=`-tP` for compiling.\n\n* `-s|--ssh` and `-H|--https`:\nOverride using HTTPS or SSH when accesssing github.com and gist.github.com\nin the case when you don't have a ready-to-use SSH or HTTPS set-up,\n\n* `-f|--force` and `-F|--rm-rf`:\nOverride existing file with `-f|--force`.\nOverride existing directory with `-F|--rm-rf`.\n\n* For `git-get`, leaving an empty `--` at the end creates a\n[sparse checkout](https://git-scm.com/docs/git-sparse-checkout)\nrepo, cone mode.\n\n* `-x`, `-B|--single-branch`, and `-T|--no-tags`:\n`-x` will keep the `.git` so you can make changes.\nThe repository is NOT 100% the same as a regular `git-clone`'d one,\nas only commits are fetched but not file contents.\nYou cannot use it together with `-t|--tag`.\nTo take a deeper look at the difference, please read the following reference:\n[git partial clone](https://git-scm.com/docs/partial-clone).\nFor repos with many branches / git tags, specifying `-B` and/or `-T` will\nremove unused branches / git tags.\n\n* `-t|--tag`:\nInstead of keeping a respository, generate a single file called `VERSION`\nthat contains the SHA-1 of the commit you accessed.\nPut it along side with your downloaded file or inside your downloaded directory\nso you will know from where the file/dir is obtained.\nYou cannot use it together with `-x`.\n\nNot all options are shown here.\nFor additional ones, refer to `man git-get` and `man git-gets`.\n\n## Install and Upgrade\n\n(The upgrading process and install process are identical.)\n\n- Arch Linux\n\n    It's on [AUR](https://aur.archlinux.org/packages/git-get):\n    ```bash\n    yay install git-get\n    rua install git-get\n    ...\n    ```\n\n- Linux but not Arch Linux\n\n    We recommend that you download the latest release and untar the files:\n    ```bash\n    # Install git-get(1) globally:\n    curl -fsSL https://github.com/b1f6c1c4/git-get/releases/latest/download/git-get.tar.xz | sudo tar -C /usr -xJv\n    # Or, locally:\n    mkdir -p ~/.local/\n    curl -fsSL https://github.com/b1f6c1c4/git-get/releases/latest/download/git-get.tar.xz | tar -C ~/.local/ -xJv\n    ```\n\n- MacOS\n\n    ```bash\n    # Install dependencies, including realpath(1):\n    brew install coreutils\n    # Install git-get(1) globally:\n    curl -fsSL https://github.com/b1f6c1c4/git-get/releases/latest/download/git-get.tar.xz | sudo tar -C /usr/local -xJv\n    # Or, locally:\n    mkdir -p ~/.local/bin/\n    curl -fsSL https://github.com/b1f6c1c4/git-get/releases/latest/download/git-get.tar.xz | tar -C ~/.local/ -xJv\n    ```\n\n- Windows\n\n    Similar as above, but you need to manually download the two files [git-get](https://github.com/b1f6c1c4/git-get/blob/master/git-get) and [git-gets](https://github.com/b1f6c1c4/git-get/blob/master/git-gets) and put it in `PATH`. As for the documentation, you will need to browse it online.\n\nYou DO NOT need to setup `git config alias.get '!git-get'`.\nIn fact, git is so smart that, as long as `git-get` is in `PATH`, `git \u003cxyz\u003e` will be interpreted as `git-\u003cxyz\u003e`.\n\n## Requirements\n\n* `bash`, can be `GNU bash` on Linux / MacOS, or `Git bash` on Windows\n* `git` **2.20+**, the newer the better\n* `sed`, and `grep`\n    * On Linux: You should already have them installed.\n    * On MacOS: You should already have them installed.\n    * On Windows:\n        ```bash\n        choco install grep sed\n        ```\n* (optional) `curl` for `-u|--upstream` functionality\n* (optional) `kcov` for checking coverage\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1f6c1c4%2Fgit-get","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb1f6c1c4%2Fgit-get","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1f6c1c4%2Fgit-get/lists"}