A small tool to clone git repositories to a standard location, organised by domain name and path.

Related tags

Utilities git rust cli tool
Overview

⤵️
Git Grab

A small tool to clone git repositories to a standard location, organised by domain name and path. Runs on BSD, Linux, macOS, Windows, and more.


Grab clones the repo into $GRAB_HOME/github.com/wezm/git-grab where GRAB_HOME defaults to ~/src if not set or supplied via the --home argument. For example:

$ git grab github.com/wezm/git-grab
Grab https://github.com/wezm/git-grab to /home/wmoore/src/github.com/wezm/git-grab
Cloning into '/home/wmoore/src/github.com/wezm/git-grab'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 30 (delta 9), reused 27 (delta 7), pack-reused 0
Receiving objects: 100% (30/30), 12.50 KiB | 12.50 MiB/s, done.
Resolving deltas: 100% (9/9), done.

$ exa --tree ~/src
/home/wmoore/src
└── github.com
   └── wezm
      └── git-grab
         ├── Cargo.lock
         ├── Cargo.toml
         └── src
            ├── args.rs
            ├── grab.rs
            └── main.rs

Download

Pre-compiled binaries are available for a number of platforms.

Example to download and extract a binary:

curl https://releases.wezm.net/git-grab/0.1.2/git-grab-0.1.2-x86_64-unknown-linux-musl.tar.gz | tar zxf -

Usage

USAGE:
    git grab [OPTIONS] [URL]...

ARGS:
    ...
        One or more git URLs to clone. Any URL accepted by `git` is valid.
        In addition, URLs without a scheme such as
        github.com/wezm/git-grab are also accepted.

OPTIONS:
    -h, --help
            Prints help information

        --home [default: ~/src]
            The directory to use as "grab home", where the URLs will be
            cloned into. Overrides the GRAB_HOME environment variable if
            set.

    -n, --dry-run
            Don't clone the repository but print what would be done.

    -V, --version
            Prints version information

ENVIRONMENT
    GRAB_HOME
        See --home

Build from Source

Minimum Supported Rust Version: 1.51.0

git-grab is implemented in Rust. See the Rust website for instructions on installing the toolchain.

From Git Checkout or Release Tarball

Build the binary with cargo build --release --locked. The binary will be in target/release/git-grab.

From crates.io

cargo install git-grab

Credits

This tool is inspired by grab by @jmhodges. A small comparison:

Feature Original This Version
VCS Supported Git, Mercurial, Subversion, and Bazaar Git
Dependencies None git
Progress Information No Yes, provided by git

Licence

This project is dual licenced under either of:

at your option.

Comments
  • Feature request: keeping repositories up to date

    Feature request: keeping repositories up to date

    Hi,

    first of all, thank you for this tool. I've been doing the same manually until I found this from Lobsters.

    Currently, I have hundreds of git repositories structured precisely like this and I have a crude shell script to keep them up to date.

    Do you think it would be out of scope for git-grab to also keep the git repository remotes found at $GRAB_HOME updated?

    Thanks!

    opened by jrasanen 5
  • No issue, just thanks

    No issue, just thanks

    I appreciate this tool so much. I had a horky fish function that tried to do what this tool does PERFECTLY I wish this was the default for cloning, it does exactly what I need.

    Great job, and THANK YOU!

    opened by bdmorin 1
  • [maybe interesting] organize existing git repositories similar to `git-grab`

    [maybe interesting] organize existing git repositories similar to `git-grab`

    When installing ein with cargo install gitoxide, one can run ein tools organize to get a listing of how repositories would be moved if --execute was specified.

    It could help to organize a pre-existing loose structure into the one proposed by git-grab, and from there git-grab could be used to maintain structure on any clone.

    In any case, I will be using git-grab from now on as it's easier than git clone + ein t organize -e.

    opened by Byron 0
  • support passing args to clone command

    support passing args to clone command

    it would be nice to pass args to the git clone command.

    use case:

    let's say i'm cloning a large repo and i want to pass in the --depth=1 arg, then the following command would come in handy: git grab --depth=1 URL

    so prolly git-grab can pass all additional optional args to the git clone command?

    accepted 
    opened by notjedi 1
  • [feature-request] winget package

    [feature-request] winget package

    Area: distribution OS: Windows Version: 10.X, 11.X

    Description: git-grab is currently not available as a winget package.

    Notes: really like the package, is this something that could be considered?

    help wanted 
    opened by arpadbarta 2
Releases(1.0.1)
Owner
Wesley Moore
Developer with an interest in systems ranging from microcontrollers to web applications. Fan of Rust, Linux, and FreeBSD.
Wesley Moore
A simple web-app allowing you to batch archive groups of repositories from a given organization

ice-repos My goal here is to build a simple web-app allowing you to batch archive groups of repositories from a given organization, using Rust+Yew. As

Nic McPhee 6 Nov 5, 2022
A rust interval arithmetic library which provides flags that detect domain errors.

intervals-good A Rust interval arithmetic library which provides flags that detect domain errors, supports more functions than any other interval arit

Oliver Flatt 3 Jul 27, 2022
You can name anonymous Future from async fn without dyn or Box!

rename-future You can name anonymous Future from async fn without dyn or Box! PLEASE READ THIS THIS PROJECT NOT YET WELL TESTED! DON'T USE THIS IN PRO

Jun Ryung Ju 54 Sep 17, 2022
Booru software for the 21st century. (Name is supposed to be like Puro, the big monster, but I failed..)

Pooru Booru software for the 21st century. Setup Setup is a little funky, but I hope to fix this funkyness down the road. First and foremost, you will

null 2 May 8, 2022
A snapshot of name squatting on crates.io

Machine-readable database of public packages on crates.io which meet an arbitrary, unwritten, sensible definition of name squatting: squatted.csv Form

David Tolnay 69 Feb 1, 2023
Prints the absolute path of all regular files in an unmounted btrfs filesystem image.

btrfs-walk-tut Prints the absolute path of all regular files in an unmounted btrfs filesystem image. Learning about btrfs: Btrfs Basics Series This re

Nishal Kulkarni 2 Feb 3, 2022
Open-source Rewind.ai clone written in Rust and Vue running 100% locally with whisper.cpp

mind-overflow Open-source Rewind.AI clone built with Tauri and Vue. Leverages whisper.cpp for Speech-to-Text and (wip: llama.cpp for Text generation a

Maxime Dolores 4 Aug 9, 2023
A flexible, simple to use, immutable, clone-efficient String replacement for Rust

A flexible, simple to use, immutable, clone-efficient String replacement for Rust. It unifies literals, inlined, and heap allocated strings into a single type.

Scott Meeuwsen 119 Dec 12, 2022
Akinator clone in Rust with Tauri, written in 2 days

Rustinator Akinator clone written in Rust + Tauri in 2 days How to play Install Rust Install Tauri Open a cmd/Terminal in this folder. Run cd src-taur

Face 5 Jul 17, 2023
Zellij plugin to quickly navigate your panes (clone of nvim's harpoon)

harpoon A Zellij plugin for quickly searching and switching between tabs. Copy of the original harpoon for nvim. Usage a to add pane to list Up and Do

null 13 Aug 11, 2023
This is an implementation defining standard for client-side-validation

Client-side-validation Foundation Libraries This is an implementation defining standard of client-side-validation representing a set of its Foundation

LNP/BP Association 8 Dec 3, 2022
DIP20: A fungible token standard for the DFINITY Internet Computer.

DIP20 - Introduction Token standards are essential for the Internet Computer ecosystem, especially for the decentralized finance ecosystem (DeFi) syst

Psychedelic 48 Nov 5, 2022
Simple and fast git helper functions

Simple and fast git helper functions

LongYinan 126 Dec 11, 2022
Verbump - A simple utility written in rust to bump and manage git semantic version tags.

Verbump - A simple utility written in rust to bump and manage git semantic version tags.

Sarat Chandra 6 May 6, 2022
Simple git/hg tui client focused on keyboard shortcuts

verco A simple Git/Hg tui client focused on keyboard shortcuts Screenshots Platforms This project uses Cargo and pure Rust stable and works on latest

Matheus Lessa Rodrigues 214 Dec 26, 2022
🌌⭐ Git tooling of the future.

❯ Glitter Git tooling of the future. ❯ ?? Features Config files Fast Easy to use Friendly errors ❯ ?? Documentation For proper docs, see here ❯ ✋ What

Milo 229 Dec 22, 2022
Estimate the amount of time spent working on a Git repository

jikyuu (時給) A tool to estimate the amount of time spent working on a Git repository. It is a direct port of git-hours, written in Node.js, because the

null 18 Nov 16, 2022
Stacked branch management for Git

git-stack Stacked branch management for Git Dual-licensed under MIT or Apache 2.0 Documentation About Installation Getting Started Reference FAQ Compa

Ed Page 1 Jul 18, 2022
Lintje is an opinionated linter for Git.

Lintje Lintje is an opinionated linter for Git. It lints commit messages based on a preconfigured set of rules focussed on promoting communication bet

Tom de Bruijn 26 Dec 18, 2022