jj-git-clone
Clone Git repositories using jj
TLDR
Create a new repo backed by a clone of a Git repo into a new directory (the default directory is the repository name)
Create a clone and use the given name for newly created remote
Clone a Git repo, only fetching the 10 most recent commits
Clone colocating the Jujutsu repo with the Git repo (allowing the use of both jj and git commands in the same directory)
SYNOPSIS
jj git clone [OPTIONS] <URL> [<DIR>]
PARAMETERS
-c, --colocate
Colocate jj repo with Git repo (default)
--no-colocate
Store jj repo separately from Git repo
--git, -g
Clone only Git repo, no jj workspace
--bare
Clone bare repository (passed to git clone)
--mirror
Mirror repository (passed to git clone)
-b <branch>, --branch <branch>
Checkout specific branch (passed to git clone)
--depth <depth>
Shallow clone to depth (passed to git clone)
DESCRIPTION
The jj git clone command clones a Git repository and, by default, initializes a colocated Jujutsu (jj) workspace on top of it. Jujutsu is a Git-compatible version control system that provides advanced features like undo, lightweight operation recording, and automatic rebasing.
This command bridges traditional Git workflows with jj's enhancements, allowing users to work with existing Git remotes seamlessly. When executed, it performs a git clone under the hood and sets up jj metadata alongside the Git repo in a .jj directory.
Use --git to clone only the Git repo without jj. The destination directory is optional; if omitted, it uses the repository name from the URL. Supports standard Git clone options like --depth, -b, and --bare, which are forwarded to git clone.
Ideal for migrating Git projects to jj or starting fresh with jj's powerful change-tracking capabilities while preserving Git compatibility.
CAVEATS
Requires jj and git installed. Colocated mode stores jj data in .jj/ inside Git repo; avoid manual edits. Not all Git URLs supported if Git isn't configured properly.
Shallow clones may limit jj history operations.
EXAMPLE
jj git clone https://github.com/example/repo.git my-repo
Clones repo into my-repo/ with jj workspace.
jj git clone --git https://github.com/example/repo.git
Clones only Git repo.
POST-CLONE
After cloning, use jj log to view changes, jj new for new changes, or jj git push to push to Git remote.
HISTORY
Jujutsu (jj) developed by Martin von Zweigbergk at Google, first public release in 2023. jj git clone introduced early to ease Git-to-jj transitions, evolving with jj v0.1+ to support more Git options.


