LinuxCommandLibrary

jj-git

Synchronize Jujutsu with Git remote

TLDR

Create a new Git backed repository

$ jj git init
copy

Create a new repository backed by a clone of a Git repository
$ jj git clone [source]
copy

Fetch from a Git remote
$ jj git fetch
copy

Push all tracked bookmarks to Git remote
$ jj git push
copy

Push given bookmark to Git remote
$ jj git push [[-b|--bookmark]] [bookmark]
copy

SYNOPSIS

jj git export|import|push|pull [--revision REVISION] [REMOTE]

PARAMETERS

export
    Export recent jj changes as Git commits to the colocated repo.

import
    Import new Git commits into jj's operation log.

push
    Push jj-tracked branches/refs to a Git remote.

pull
    Fetch from Git remote and import into jj.

--revision, -r REV
    Limit operation to specific revision(s), e.g., '@-' for last change.

--remote NAME
    Specify Git remote (default: 'origin').

--all
    Operate on all branches/refs (for push/pull).

--from REV
    Export/import starting from given revision (export).

DESCRIPTION

The jj git command (often aliased or referred to as jj-git in some contexts) is part of Jujutsu (jj), a Git-compatible version control system. It enables seamless interoperability between jj repositories and standard Git repositories. Jujutsu uses Git as its underlying storage but adds an operation log for advanced features like automatic rebase, undo, and conflict-free history rewriting.

jj git supports key operations: exporting jj changes to Git commits, importing Git changes into jj, pushing jj-tracked branches to Git remotes, and pulling from Git remotes into jj. This allows hybrid workflows, gradual migration from Git to jj, or using jj's superior UX on existing Git repos.

Typically colocated with a .git directory, it auto-detects the Git repo. Changes in jj are not visible in Git until exported, preserving Git's linear history while leveraging jj's flexibility.

CAVEATS

Requires colocated .git directory; Git sees only exported commits, not jj operations. Concurrent Git/jj use may need coordination to avoid conflicts. Not for remote-only Git repos.

EXAMPLE USAGE

jj git export # Export latest changes to Git
jj git push --all origin # Push all branches to remote
jj git pull origin main # Pull and import specific branch

MIGRATION TIP

Clone Git repo with jj git clone, work in jj, periodically jj git export && git push to sync back.

HISTORY

Part of Jujutsu project, started by Martin von Zweigbergk (Google) in 2022. Initial Git bridge in v0.1.0 (2023); matured in v0.10+ with stable push/pull. Aims to supersede Git long-term.

SEE ALSO

jj(1), git(1), git-push(1), git-fetch(1)

Copied to clipboard