LinuxCommandLibrary

jj-git-init

Initialize jj repository with Git

TLDR

Create a new Git backed repo in the current directory

$ jj git init
copy

Create a new Git backed repo in the given directory
$ jj git init [path/to/directory]
copy

Initialize the Jujutsu repository as a valid Git repository (allowing the use of both jj and git commands in the same directory)
$ jj git init --colocate
copy

Initialize the Jujutsu repository backed by an existing Git repository
$ jj git init --git-repo [git_repo]
copy

SYNOPSIS

jj git init [PATH] [--colocate | --no-colocate] [--git-repo PATH]

PARAMETERS


    Directory for the new repository (default: current directory)

--colocate
    Create colocated Git repo alongside jj repo (default)

--no-colocate
    Initialize jj repo without colocated Git repo

--git-repo
    Use existing Git repo at PATH instead of creating new one

DESCRIPTION

The jj git init command creates a new repository using Jujutsu (jj), a Git-compatible version control system designed for better usability. It initializes both a Jujutsu repo and a colocated Git repo in the specified PATH (or current directory). This enables seamless push/pull with Git tools while leveraging jj's advanced features like operation logs, automatic rebases, and a unified working copy model.

Jujutsu models history as a graph of changes with undoable operations, reducing conflicts and simplifying workflows. The colocated Git repo maintains standard Git compatibility for collaboration. Ideal for new projects or migrating to jj without breaking Git interop.

CAVEATS

Git must be installed; colocated mode recommended for full Git compatibility. Non-colocated repos limit some Git interop features.

EXAMPLES

jj git init myproject
jj git init --no-colocate ~/repo
jj git init --git-repo /existing/git/repo

POST-INIT

Run jj git config remote.origin.url <URL> to set upstream; use jj git push for Git compatibility.

HISTORY

Jujutsu (jj) developed by Martin von Zweigbergk at Google; first public release ~2023 as Git-compatible VCS with operation-based model. jj git init added for easy Git-hybrid setups.

SEE ALSO

git-init(1), jj init(1)

Copied to clipboard