A git toolkit to facilite working with a large number of repositories
zig build
Only POSIX environments are currently supported.
For more information on errors, use the --debug
option.
zig-out/bin/gittk --debug
Clone repositories into a tree structure under the default $HOME/projects. Both relative and absolute paths are supported.
zig-out/bin/gittk clone [email protected]:ziglang/zig.git
Clone repositories into a different path other than the default $HOME/projects using the --project
, -p
option.
zig-out/bin/gittk --project=/tmp/gittk clone [email protected]:ziglang/zig.git
Clone repositories into a different path other than the default $HOME/projects using the GITTK_PROJECT
environment variable.
env GITTK_PROJECT=/tmp/gittk66 zig-out/bin/gittk clone [email protected]:ziglang/zig.git
$ zig-out/bin/gittk clone git@github.com:ziglang/zig.git
Cloning into '/home/user/projects/github.com/ziglang/zig'...
remote: Enumerating objects: 332686, done.
remote: Counting objects: 100% (517/517), done.
remote: Compressing objects: 100% (199/199), done.
remote: Total 332686 (delta 413), reused 318 (delta 318), pack-reused 332169 (from 3)
Receiving objects: 100% (332686/332686), 351.28 MiB | 2.46 MiB/s, done.
Resolving deltas: 100% (252669/252669), done.
Updating files: 100% (20604/20604), done.
/home/user/projects/github.com/ziglang/zig
$ zig-out/bin/gittk clone git@github.com:ziglang/zig.git
fatal: destination path '/home/user/projects/github.com/ziglang/zig' already exists and is not an empty directory.
/home/user/projects/github.com/ziglang/zig
$ zig-out/bin/gittk clone git@github.com:ziglang/doesnotexist.git
Cloning into '/home/user/projects/github.com/ziglang/doesnotexist'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
/home/user/projects/github.com/ziglang/doesnotexist
Execute the tree command, three levels deep, on the project directory.
This command requires tree
to be on PATH.
gittk tree
/home/user/projects
├── codeberg.org
│ ├── j5ndev
│ │ ├── gittk
│ │ ├── rayliblab
│ │ ├── weblab
│ │ └── ziglings_exercises
│ └── pepomija
│ └── pandora
└── github.com
├── Alkaid-Benetnash
│ └── EmuBTHID
├── blythinart
│ └── blythinart.github.io
├── ghostty-org
│ └── ghostty
├── j5ndev
│ ├── exercism
│ ├── gittk
│ ├── kata
│ ├── rayliblab
│ ├── weblab
│ ├── ziglab
│ └── ziglings_exercises
├── nektro
│ └── zigmod
├── pepomija
│ ├── game-aster
│ ├── habitual
│ └── pandora
├── ziglang
│ ├── runner
│ └── zig
└── zigtools
└── zls
Execute the ls command. All repository directories will be listed.
gittk ls
$ zig-out/bin/gittk ls
/home/user/projects/github.com/Alkaid-Benetnash/EmuBTHID
/home/user/projects/github.com/j5ndev/gittk
/home/user/projects/github.com/j5ndev/kata
/home/user/projects/github.com/j5ndev/rayliblab
/home/user/projects/github.com/j5ndev/exercism
/home/user/projects/github.com/j5ndev/ziglab
/home/user/projects/github.com/j5ndev/ziglings_exercises
/home/user/projects/github.com/j5ndev/weblab
/home/user/projects/github.com/zigtools/zls
/home/user/projects/github.com/nektro/zigmod
/home/user/projects/github.com/ziglang/runner
/home/user/projects/github.com/ziglang/zig
/home/user/projects/github.com/pepomija/game-aster
/home/user/projects/github.com/pepomija/habitual
/home/user/projects/github.com/pepomija/pandora
/home/user/projects/github.com/ghostty-org/ghostty
/home/user/projects/github.com/blythinart/blythinart.github.io
/home/user/projects/codeberg.org/j5ndev/gittk
/home/user/projects/codeberg.org/j5ndev/rayliblab
/home/user/projects/codeberg.org/j5ndev/ziglings_exercises
/home/user/projects/codeberg.org/j5ndev/weblab
/home/user/projects/codeberg.org/pepomija/pandora
Execute the ls command with the url option. All repository remote origin urls will be listed.
gittk ls --url
$ zig-out/bin/gittk ls --url
https://github.com/Alkaid-Benetnash/EmuBTHID.git
[email protected]:j5ndev/gittk.git
[email protected]:j5ndev/kata.git
[email protected]:j5ndev/rayliblab.git
[email protected]:j5ndev/exercism.git
[email protected]:j5ndev/ziglab.git
[email protected]:j5ndev/ziglings_exercises.git
[email protected]:j5ndev/weblab.git
[email protected]:zigtools/zls.git
[email protected]:nektro/zigmod.git
[email protected]:ziglang/runner.git
[email protected]:ziglang/zig.git
[email protected]:pepomija/game-aster.git
[email protected]:pepomija/habitual.git
[email protected]:pepomija/pandora.git
https://github.com/ghostty-org/ghostty.git
[email protected]:blythinart/blythinart.github.io.git
[email protected]:j5ndev/gittk.git
[email protected]:j5ndev/rayliblab.git
[email protected]:j5ndev/ziglings_exercises.git
[email protected]:j5ndev/weblab.git
[email protected]:pepomija/pandora.git
Execute all tests with the following command.
zig build test --summary new
Quick shortcuts to commonly executed commands can be found in the bin
folder.
bin/test
bin/build
bin/test_exe
Here is an example of a helper shell function to clone the repo and then cd into the directory.
For example, you would add this snippet to your .zshrc
file if you are using zsh.
clone () {
local TARGET=`gittk clone $@ | tail --lines=1`
cd $TARGET
}