jj-git-remote
Manage Git remotes
TLDR
List all Git remotes
Add a Git remote
Change the URL of a Git remote
Remove a Git remote
Rename a Git remote
SYNOPSIS
jj git-remote subcommand [options] [arguments...]
PARAMETERS
subcommand
The specific operation to perform on Git remotes. Common subcommands include fetch, push, track, untrack, and list.
fetch
Fetches new changes and remote branches from a configured Git remote into the Jujutsu repository.
push
Pushes local Jujutsu changes (commits and branches) to a configured Git remote.
track GIT_REMOTE_BRANCH JJ_BRANCH
Configures a Jujutsu branch (JJ_BRANCH) to track a specific Git remote branch (GIT_REMOTE_BRANCH), establishing a one-to-one relationship.
untrack GIT_REMOTE_BRANCH
Removes the tracking configuration for a Git remote branch, disassociating it from any Jujutsu branch.
list
Lists all configured Git remotes, their URLs, and their tracking relationships with Jujutsu branches.
--remote NAME
Specifies the name of the Git remote to interact with (e.g., 'origin', 'upstream'). This option is common for fetch and push.
--branch NAMES...
Specifies one or more branches to fetch or push. Can be used multiple times to include multiple branches.
--all
Used with 'fetch' or 'push' to operate on all branches configured for the remote.
--force
Forces the push operation, potentially overwriting remote history. Use with extreme caution as this can lead to data loss.
--rebase
Used with 'fetch' to automatically rebase local branches on top of their newly fetched remote counterparts after fetching.
--json
Outputs command results in JSON format, which is useful for scripting and programmatic integration.
DESCRIPTION
jj-git-remote is an external command within the Jujutsu (jj) version control system that facilitates seamless interaction with Git remotes. While jj introduces a unique and powerful approach to version control, it acknowledges the prevalent use of Git. This command acts as a crucial bridge, enabling jj users to fetch updates from and push local changes to existing Git repositories. It handles the necessary underlying Git operations, abstracting away the complexities, to synchronize the jj repository's state with a remote Git server. This interoperability is vital for collaborative workflows, allowing teams to mix jj and traditional Git users, or for integrating jj into existing Git-centric pipelines without disruption. It ensures that Jujutsu repositories can fully participate in the broader Git ecosystem.
CAVEATS
Understanding the differences between Jujutsu's internal data model and Git's is crucial for effective use of jj-git-remote. While it bridges the gap, concepts like 'branches' and 'history' are managed differently. Force pushing (with --force
) can lead to irreversible loss of remote history and should be used with extreme caution. The command's behavior and available options may evolve as Jujutsu is under active development.
INTERACTION MODEL
The jj-git-remote command manages the synchronization between Jujutsu's internal repository state and a Git remote. When fetching, it pulls Git references (branches, tags) into a dedicated 'git/' namespace within the Jujutsu repository's ref store. When pushing, it translates Jujutsu changes (such as new commits and branch movements) into standard Git objects and references, ensuring the underlying Git repository remains compatible with standard Git clients.
REMOTE CONFIGURATION
Git remotes for jj are configured within the Jujutsu repository's configuration. This is typically done in the .jj/repo/config.json
file or through global jj configuration settings. The configuration specifies the URL of the remote and can include other options like default branches for fetching/pushing, similar to how Git itself manages remotes.
HISTORY
Jujutsu (jj) was developed by Martin Pool as a modern, user-friendly alternative to Git, aiming to improve upon Git's command line interface and data model. The jj-git-remote command was an integral part of jj from its early stages, designed to provide essential interoperability with the widely adopted Git ecosystem. This allows jj users to interact with existing Git repositories, fetching and pushing changes without needing to switch back to native Git commands, thus facilitating a smooth transition and mixed-environment workflows. Its existence underscores the practical necessity of integrating with established version control systems for real-world adoption.