14 releases

new 0.3.4 Mar 25, 2023
0.3.3 Mar 18, 2023
0.3.2 Feb 14, 2023
0.3.1 Jan 17, 2023
0.1.4 Nov 22, 2022

#100 in Development tools

40 downloads per month

MIT license


🚀 ghr

crates.io Rust

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

Using Homebrew (easy)

brew install siketyan/tap/ghr

To upgrade:

brew upgrade siketyan/tap/ghr

Using cargo (classic)

If you have not installed Rust environment, follow the instruction of rustup.

cargo install ghr

For upgrading, we recommend to use cargo-update.

cargo install-update ghr

🔧 Installing the shell extension

To extend ghr features to maximum, it is recommended to install the shell extension. Add the line below to your shell configuration script to enable it.


ghr shell bash | source

To enable completions, add the line into ~/.bash_completion.

ghr shell bash --completion | source


ghr shell fish | source

To enable completions, add the line into ~/.config/fish/completions/ghr.fish.

ghr shell fish --completion | source

💚 Usages

Usage: ghr <COMMAND>

  cd       Changes directory into a repository (Shell extension required)
  clone    Clones a Git repository to local
  delete   Deletes a repository from local
  init     Initialises a Git repository in local
  list     Lists all managed repositories
  open     Opens a repository in an application
  path     Prints the path to root, owner, or a repository
  profile  Manages profiles to use in repositories
  shell    Writes a shell script to extend ghr features
  version  Prints the version of this application
  help     Print this message or the help of the given subcommand(s)

  -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://git@github.com/<owner>/<repo>.git
ghr clone git@github.com:<owner>/<repo>.git

If you have installed the shell extension, you can change directory into the cloned repository:

ghr clone <url_or_pattern> --cd

If you often use repositories of a specific owner, you can set the default owner to be resolved.

owner = "siketyan"
ghr clone <repo>

Changing directory

You can change directory into a repository on the shell. It requires installing the shell extension.

ghr cd <url_or_pattern>

Attaching profiles

Create ~/.ghr/ghr.toml and edit as you like:

user.name = "Your Name"
user.email = "your_name@personal.example.com"

user.name = "Your Name (ACME Inc.)"
user.email = "your_name@company.example.com"

profile.name = "company"
owner = "acme" # Applies company profiles to all repositories in `acme` org

profile.name = "default"

Configuring applications to open repos in

Edit ~/.ghr/ghr.toml and add entries as you like:

cmd = "code"
args = ["%p"]

Note %p will be replaced by the repository path.

Finding path of the repository

ghr path # Root directory
ghr path <owner>/<repo> # Repository directory
ghr path <url> # Repository directory resolved by URL
ghr path github.com/<owner>/<repo> # Repository directory of the specified host
ghr path --owner=<owner> # Owner root
ghr path --host=github.com # Host root
ghr path --host=github.com --owner=<owner> # Owner root 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


~1M SLoC