#git-repository #url-path #directory #local #derived #cloning #standard

bin+lib git-clone-canonical

Clone git repositories into a local path derived from the URL

5 releases

0.1.5 Oct 20, 2023
0.1.4 Oct 20, 2023
0.1.3 Sep 11, 2022
0.1.2 Jul 23, 2022
0.1.1 May 25, 2022

#916 in Development tools

MIT license

12KB
288 lines

git-clone-canonical

Clone a git repository into a standard local path derived from the URL.

Example

$ git clone-canonical 'https://github.com/nathan-at-least/git-clone-canonical'
[INFO ] repository path "/home/user/src/github.com/nathan-at-least/git-clone-canonical"
[INFO ] creating parent directory "/home/user/src/github.com/nathan-at-least"
[INFO ] cloning "https://github.com/nathan-at-least/git-clone-canonical"
Cloning into 'git-clone-canonical'...
remote: Enumerating objects: 58, done.
remote: Counting objects: 100% (58/58), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 58 (delta 17), reused 54 (delta 17), pack-reused 0
Receiving objects: 100% (58/58), 13.11 KiB | 2.62 MiB/s, done.
Resolving deltas: 100% (17/17), done.

Fetching

If there is already a directory at the expected path, run git fetch instead:

$ git clone-canonical 'https://github.com/nathan-at-least/git-clone-canonical'
[INFO ] repository path "/home/user/src/github.com/nathan-at-least/git-clone-canonical"
[INFO ] fetching "https://github.com/nathan-at-least/git-clone-canonical"
From https://github.com/nathan-at-least/git-clone-canonical
 * branch            HEAD       -> FETCH_HEAD

That's it.

Dependencies

~8–17MB
~216K SLoC