LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

jj-git-root

print the path of the backing Git directory

TLDR

Print the underlying Git directory
$ jj git root
copy
Point GitHub CLI at a non-colocated repo
$ GIT_DIR=$(jj git root) gh issue list
copy
Use the path as GIT_DIR for other Git-aware tools
$ export GIT_DIR=$(jj git root)
copy

SYNOPSIS

jj git root [options]

DESCRIPTION

jj git root prints the path of the underlying Git directory for a repository that uses the Git backend.In a colocated workspace that is the workspace-root `.git` directory. In a non-colocated workspace the Git store is hidden under `.jj` (typically `.jj/repo/store/git`), so Git tools that look for `.git` in the working copy fail unless you set GIT_DIR to this path.A common case is GitHub CLI (`gh`) in a non-colocated repo: `GITDIR=$(jj git root) gh issue list`. **direnv** users can put `export GITDIR=$(jj git root)` in `.envrc` so that happens automatically.This is not the workspace root. For the directory that contains the working copy, use jj workspace root (or jj root).

PARAMETERS

-R, --repository PATH

Operate on the repository at PATH instead of searching upward from the current directory.
-h, --help
Display help information.

INSTALL

sudo pacman -S jujutsu
copy
sudo apk add jujutsu
copy
sudo zypper install jujutsu
copy
brew install jujutsu
copy
nix profile install nixpkgs#jujutsu
copy

CAVEATS

Subcommand of jj. Requires the Git backend; it errors on a non-Git repository. The printed path may be a `.git` file (a gitdir pointer) rather than a directory in some layouts.

SEE ALSO

RESOURCES

Copied to clipboard
Kai