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

bin+lib git-clone-canonical

将 git 仓库克隆到由 URL 导出的本地路径中

5 个版本

0.1.5 2023 年 10 月 20 日
0.1.4 2023 年 10 月 20 日
0.1.3 2022 年 9 月 11 日
0.1.2 2022 年 7 月 23 日
0.1.1 2022 年 5 月 25 日

#881 in 开发工具

MIT 许可证

12KB
288 代码行

git-clone-canonical

将 git 仓库克隆到由 URL 导出的标准本地路径。

示例

$ 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.

获取

如果预期路径中已存在目录,则运行 git fetch 而不是

$ 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

就是这样。

依赖项

~7–15MB
~212K SLoC