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 [-r|--repo PATH] [--sparse] [DIRECTORY]

PARAMETERS

-r, --repo PATH
    Specifies the path to the repository root directory to initialize. If not provided, it defaults to the current directory.

--sparse
    Initializes the repository with a sparse working copy, meaning only files tracked by Jujutsu will be included in the working directory.

DESCRIPTION

jj-git-init creates a new Jujutsu (jj) repository in the current directory or a specified path, simultaneously initializing a Git repository as its backend. This command allows users to leverage Jujutsu's advanced features, such as rebase by default, explicit state, and powerful conflict resolution, while maintaining compatibility with the Git ecosystem. It is particularly useful for those transitioning from Git, working on projects already managed by Git, or needing to push to and pull from remote Git repositories seamlessly. The command sets up the necessary internal structure for Jujutsu to manage commits, branches, and the working copy, with Git serving as the underlying storage layer. This hybrid setup simplifies workflows that involve both Git and Jujutsu operations.

CAVEATS

This command requires Git to be installed and accessible in your system's PATH. While it uses Git as a backend, direct manipulation of the underlying Git repository using standard Git commands is generally discouraged, as Jujutsu manages its state and might not always reflect a state directly interpretable by Git. It is best to interact primarily through jj commands. This command initializes a new Git repository; it does not take over an existing Git repository's .git directory.

BACKEND TYPE

Unlike the generic jj init command, jj-git-init explicitly and exclusively initializes a Jujutsu repository with a Git backend. This makes it the preferred command when Git compatibility and interaction with Git remotes are primary requirements.

GIT COMPATIBILITY

The repository created by jj-git-init is fully compatible with Git remotes. This enables jj to push changes to and pull changes from standard Git repositories, making it easy to integrate Jujutsu into existing Git-centric development workflows without disruption.

HISTORY

Jujutsu (jj) is a modern, experimental version control system designed to be a more user-friendly and powerful alternative to Git. The jj-git-init command is central to its design philosophy of interoperability, allowing users to leverage Jujutsu's innovative features while still collaborating with Git users and infrastructure. It was developed to simplify the transition for Git users and ensure seamless integration with existing Git workflows.

SEE ALSO

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

Copied to clipboard