Files
gh-dashed-claude-marketplac…/references/commands.md
2025-11-29 18:17:51 +08:00

13 KiB

Commands Reference

Complete reference for jj commands and their options.

Table of Contents

Repository Setup

jj git clone

Clone a Git repository:

jj git clone <url> [destination]
jj git clone --colocate <url>     # Allow git commands (default)
jj git clone --no-colocate <url>  # jj-only repo
jj git clone --branch <branch>    # Clone specific branch
jj git clone --depth <n>          # Shallow clone

jj git init

Initialize a new repository:

jj git init                       # New colocated repo (default)
jj git init --no-colocate         # New jj-only repo
jj git init --git-repo <path>     # Use existing git repo as backend

Status and History

jj status (alias: st)

Show working copy status:

jj status
jj st [paths...]                  # Status for specific paths

jj log

Show commit history:

jj log                            # Default: mutable commits
jj log -r <revset>                # Specific revisions
jj log -r '::'                    # All commits
jj log -n 10                      # Limit to 10 commits
jj log -p                         # Show patches
jj log -s                         # Summary (files changed)
jj log --stat                     # Show diffstat
jj log --no-graph                 # Flat list, no graph
jj log --reversed                 # Oldest first
jj log -T <template>              # Custom template
jj log [paths...]                 # Commits touching paths

jj show

Show commit details:

jj show                           # Current working copy
jj show <rev>                     # Specific revision
jj show -s                        # Summary only
jj show -p                        # Patch (default)
jj show --stat                    # Diffstat
jj show --git                     # Git-format diff

jj diff

Show changes:

jj diff                           # Changes in working copy
jj diff -r <rev>                  # Changes in revision vs parent
jj diff --from <rev>              # From specific revision
jj diff --to <rev>                # To specific revision
jj diff --from <A> --to <B>       # Between two revisions
jj diff -s                        # Summary
jj diff --stat                    # Diffstat
jj diff --git                     # Git format
jj diff --color-words             # Word-level diff
jj diff [paths...]                # Specific paths only

Creating and Editing Commits

jj new

Create a new commit:

jj new                            # New commit on working copy parent
jj new <rev>                      # New commit on specific revision
jj new <A> <B>                    # Merge commit with multiple parents
jj new -m "message"               # With description
jj new --no-edit                  # Don't make it working copy
jj new -A <rev>                   # Insert after revision
jj new -B <rev>                   # Insert before revision

jj describe (alias: desc)

Edit commit description:

jj describe                       # Edit working copy description
jj describe <rev>                 # Edit specific revision
jj describe -m "message"          # Set message directly
jj describe --stdin               # Read from stdin

jj edit

Switch working copy to edit existing commit:

jj edit <rev>                     # Edit specific revision

jj commit (alias: ci)

Finalize working copy and create new commit:

jj commit                         # Describe and create new
jj commit -m "message"            # With message
jj commit -i                      # Interactive selection
jj commit [paths...]              # Only specified paths

History Rewriting

jj squash

Move changes into parent:

jj squash                         # All changes to parent
jj squash -r <rev>                # From specific revision
jj squash -i                      # Interactive selection
jj squash [paths...]              # Only specific paths
jj squash --from <A> --into <B>   # Between arbitrary commits
jj squash -m "message"            # Set combined description
jj squash -k                      # Keep source (don't abandon)

jj split

Split commit into two:

jj split                          # Interactive split of working copy
jj split -r <rev>                 # Split specific revision
jj split [paths...]               # Put paths in first commit
jj split -i                       # Interactive mode
jj split -p                       # Parallel (sibling) commits
jj split -m "message"             # First commit message

jj rebase

Move commits to different parents:

# What to rebase:
jj rebase -b <rev>                # Branch containing rev (default: -b @)
jj rebase -s <rev>                # Source and descendants
jj rebase -r <rev>                # Only revision (not descendants)

# Where to rebase:
jj rebase -d <dest>               # Onto destination
jj rebase -A <rev>                # Insert after
jj rebase -B <rev>                # Insert before

# Examples:
jj rebase -d main                 # Rebase current branch onto main
jj rebase -s X -d Y               # Rebase X and descendants onto Y
jj rebase -r X -d Y               # Rebase only X onto Y
jj rebase -r X -A Y               # Insert X after Y
jj rebase -r X -B Y               # Insert X before Y

# Options:
jj rebase --skip-emptied          # Abandon commits that become empty

jj diffedit

Interactively edit commit contents:

jj diffedit                       # Edit working copy
jj diffedit -r <rev>              # Edit specific revision
jj diffedit --from <A> --to <B>   # Edit diff between revisions
jj diffedit --tool <tool>         # Use specific diff editor
jj diffedit --restore-descendants # Preserve descendant content

jj duplicate

Copy commits:

jj duplicate                      # Duplicate working copy
jj duplicate <revs>               # Duplicate specific revisions
jj duplicate -A <rev>             # Insert duplicates after
jj duplicate -B <rev>             # Insert duplicates before

jj abandon

Remove commits (keep content in descendants):

jj abandon                        # Abandon working copy
jj abandon <revs>                 # Abandon specific revisions
jj abandon --retain-bookmarks     # Move bookmarks to parents

jj restore

Restore files from another revision:

jj restore                        # Restore all from parent
jj restore [paths...]             # Restore specific paths
jj restore --from <rev>           # Source revision
jj restore --into <rev>           # Destination revision
jj restore -c <rev>               # Undo changes in revision
jj restore -i                     # Interactive mode

jj parallelize

Make commits siblings instead of parent-child:

jj parallelize <revs>             # Make revisions parallel

Bookmarks (Branches)

jj bookmark (alias: b)

Manage bookmarks:

# List
jj bookmark list
jj bookmark list -a               # Include all remotes
jj bookmark list -r <revs>        # Bookmarks at revisions

# Create/Set
jj bookmark create <name>         # At working copy
jj bookmark create <name> -r <rev>
jj bookmark set <name>            # Move to working copy
jj bookmark set <name> -r <rev>   # Move to revision
jj bookmark set <name> -B         # Allow moving backwards

# Modify
jj bookmark move <name>           # Move to working copy
jj bookmark move --from <rev>     # Move from revision
jj bookmark rename <old> <new>

# Delete
jj bookmark delete <name>         # Delete (will push deletion)
jj bookmark forget <name>         # Forget (won't push deletion)

# Remote tracking
jj bookmark track <name>@<remote>
jj bookmark untrack <name>@<remote>

Git Operations

jj git fetch

Fetch from remote:

jj git fetch                      # From default remote
jj git fetch --remote <name>      # From specific remote
jj git fetch --all-remotes        # From all remotes
jj git fetch --branch <pattern>   # Specific branches

jj git push

Push to remote:

jj git push --bookmark <name>     # Push specific bookmark
jj git push --all                 # Push all bookmarks
jj git push --tracked             # Push all tracked
jj git push --deleted             # Push deletions
jj git push --change <rev>        # Create bookmark from change
jj git push --remote <name>       # To specific remote
jj git push --dry-run             # Show what would be pushed

jj git remote

Manage remotes:

jj git remote list
jj git remote add <name> <url>
jj git remote remove <name>
jj git remote rename <old> <new>
jj git remote set-url <name> <url>

jj git import / jj git export

Sync with underlying Git repo (rarely needed in colocated repos):

jj git import                     # Import Git changes to jj
jj git export                     # Export jj changes to Git

Operation Log

jj op log

View operation history:

jj op log                         # Full operation log
jj op log -n 10                   # Limit entries
jj op log -p                      # Show patches
jj op log -d                      # Show operation diffs

jj undo / jj redo

Undo/redo operations:

jj undo                           # Undo last operation
jj redo                           # Redo after undo

jj op restore

Restore to previous state:

jj op restore <op-id>             # Restore to operation

jj op show

Show operation details:

jj op show                        # Current operation
jj op show <op-id>                # Specific operation
jj op show -p                     # With patches

File Operations

jj file

File-related commands:

jj file list                      # List files in working copy
jj file list -r <rev>             # Files in specific revision
jj file show <path>               # Show file content
jj file show -r <rev> <path>      # Content at revision
jj file annotate <path>           # Blame (line origins)
jj file chmod x <path>            # Make executable
jj file chmod n <path>            # Remove executable
jj file track <paths>             # Start tracking
jj file untrack <paths>           # Stop tracking

Workspaces

jj workspace

Manage multiple working copies:

jj workspace list                 # List workspaces
jj workspace add <path>           # Add workspace
jj workspace add -r <rev> <path>  # At specific revision
jj workspace forget [name]        # Remove workspace
jj workspace root                 # Show workspace root
jj workspace update-stale         # Update stale workspace

Configuration

jj config

Manage configuration:

jj config list                    # Show all config
jj config get <key>               # Get specific value
jj config set --user <key> <val>  # Set user config
jj config set --repo <key> <val>  # Set repo config
jj config edit --user             # Edit user config
jj config edit --repo             # Edit repo config
jj config path --user             # Show config file path

Utility Commands

Other useful commands

jj root                           # Show repo root
jj version                        # Show jj version
jj resolve                        # Resolve conflicts
jj resolve -l                     # List conflicts
jj evolog                         # Show change evolution
jj interdiff --from <A> --to <B>  # Compare changes of commits
jj next                           # Move to child commit
jj prev                           # Move to parent commit
jj fix                            # Run code formatters
jj sign                           # Sign commits
jj sparse set --add <path>        # Add to sparse checkout
jj sparse set --remove <path>     # Remove from sparse
jj util completion <shell>        # Generate shell completions
jj util gc                        # Garbage collect

Global Options

Available on all commands:

jj -R <path>                      # Use different repo
jj --at-op <op-id>                # Load at operation
jj --ignore-working-copy          # Skip working copy snapshot
jj --ignore-immutable             # Allow modifying immutable
jj --color <when>                 # always/never/auto
jj --no-pager                     # Disable pager
jj --config <key=value>           # Override config
jj --config-file <path>           # Additional config file
jj --quiet                        # Less output
jj --debug                        # Debug output