🚀
ghr
Yet another repository management with auto-attaching profiles.
🔥
Motivation
ghq is the most famous solution to resolve stress of our repository management currently. However, I wanted to customise the git configuration by some rules, such as using my company email in their repositories.
To achieve that, ghq was not enough for me. So I have rewritten them as simple, in Rust, the robust and modern language today.
📦
Installation
cargo install ghr
💚
Usages
Usage: ghr <COMMAND>
Commands:
clone Clones a Git repository to local
delete Deletes a repository from local
init Initialises a Git repository in local
path Prints the path to root, owner, or a repository
profile Manages profiles to use in repositories
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help information
Cloning a repository
ghr supports many patterns or URLs of the repository to clone:
ghr clone <owner>/<repo>
ghr clone github.com:<owner>/<repo>
ghr clone https://github.com/<owner>/<repo>.git
ghr clone ssh://[email protected]/<owner>/<repo>.git
ghr clone [email protected]:<owner>/<repo>.git
Easy!
Attaching profiles
Create ~/.ghr/config.toml
and edit as you like:
[profiles.default]
user.name = "Your Name"
user.email = "[email protected]"
[profiles.company]
user.name = "Your Name (ACME Inc.)"
user.email = "[email protected]"
[[rules]]
profile.name = "company"
owner = "acme" # Applies company profiles to all repositories in `acme` org
[[rules]]
profile.name = "default"
Finding path of the repository
ghr path # Root directory
ghr path <owner> # Owner root
ghr path <owner> <repo> # Repository directory
ghr path --host=github.com # Host root
ghr path --host=github.com <owner> # Owner root of the specified host
ghr path --host=github.com <owner> <repo> # Repository directory of the specified host
🛠
Customising
You can change the root of repositories managed by ghr by setting environment variable GHR_ROOT
in your shell profile.
ghr path # ~/.ghr
GHR_ROOT=/path/to/root ghr path # /path/to/root