Skip to content
mrjones2014Public

About

Manage GitHub PR Stacks natively with `jj`

Topics

Resources

Contributing

Stars

57 stars

Watchers

1 watching

Forks

Repository files navigation

jj-gh

GitHub pull request workflows for Jujutsu (jj), from your terminal.

  • Create PRs from revisions with your editor, templates, and frontmatter.
  • Create and reconcile GitHub stacked PRs from your local jj graph.
  • See PR numbers, CI, and merge status in jj pr log.
  • Fetch PRs into local bookmarks, including across forks.
  • Enable auto-merge and rerun CI by PR number or revision.

Works well with the jj megamerge workflow; jj-gh manages the PRs, not the local megamerge itself.

PR metadata and stack preview

For guides, configuration, and the complete CLI reference, see the documentation. The site describes the latest stable release.

Requirements

jj must be on PATH, and the repository must use the Git backend. pr fetch fetches GitHub's special refs/pull/123/head refs via gix because jj cannot yet fetch arbitrary refs.

Install

With Nix

Add the flake input. The stable branch points to the latest release; use github:mrjones2014/jj-gh to follow master, or github:mrjones2014/jj-gh/jj-gh-v0.3.1 to pin to a release tag:

{
  inputs.jj-gh.url = "github:mrjones2014/jj-gh/stable";
  outputs =
    {
      self,
      nixpkgs,
      jj-gh,
      ...
    }:
    {
      # use jj-gh.packages.${system}.default
    };
}

Use the overlay or the Home Manager module. The package installs a manpage: man jj-gh.

{ jj-gh, pkgs, ... }:
{
  # Overlay; not needed with the Home Manager module.
  nixpkgs.overlays = [ jj-gh.overlays.default ];
  home.packages = [ pkgs.jj-gh ];

  # Home Manager
  imports = [ jj-gh.homeManagerModules.default ];
  programs.jujutsu.gh = {
    enable = true;
    # aliases = { pr = "pr"; };
    settings.gh_askpass = [ "op" "read" "op://Private/GitHub/token" ];
  };
}

Optionally use the Cachix binary cache:

Precompiled binary

Download and extract the archive for your platform from the latest GitHub release. The Linux and macOS archives contain the binary and manpage. For example:

mkdir -p ~/.local/bin ~/.local/share/man/man1
install -m 755 jj-gh ~/.local/bin/jj-gh
install -m 644 jj-gh.1 ~/.local/share/man/man1/jj-gh.1

Ensure ~/.local/bin is in PATH and ~/.local/share/man is in MANPATH.

With cargo-binstall

Requires cargo-binstall:

cargo binstall jj-gh
With mise

Via the github backend:

mise use --global 'github:mrjones2014/jj-gh[version_prefix=jj-gh-v]@latest'

Via the cargo backend:

# If you already have a rust toolchain
mise use --global cargo:jj-gh@latest

# Otherwise you will need
mise use --global rust@stable cargo:jj-gh@latest
From crates.io

Requires a Rust toolchain:

cargo install jj-gh
From source

Requires a Rust toolchain. Clone this repository, then from its root:

cargo install --path .

Set up the jj alias

Add this to your jj config to use jj pr. The Home Manager module can set it up for you.

[aliases]
pr = ["util", "exec", "--", "jj-gh", "pr"]

Authenticate with gh auth login, then try jj pr log or jj pr stack --dry-run. See the getting started guide for more.

About

Manage GitHub PR Stacks natively with `jj`

Topics

Resources

Contributing

Stars

57 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages