Skip to main content

to navigate · Press ? for help

Remote Operations

jj works with git remotes but handles them differently.

Fetching Changes

git
git fetch origin
git log origin/main
jj
jj git fetch
jj log
Command comparison: git commands on the left, jj commands on the right
gitjj
git fetch originjj git fetch
git log origin/mainjj log

Pulling and Rebasing

jj doesn't have jj git pull. Instead, you fetch then rebase:

git
git pull origin main
git fetch origin
git rebase origin/main
jj
jj git fetch
jj rebase -d main@origin
Command comparison: git commands on the left, jj commands on the right
gitjj
git pull origin mainjj git fetch
git fetch originjj rebase -d main@origin
git rebase origin/main
NOTE:

The @origin suffix denotes the remote-tracking branch. main@origin is the remote's version of main.

Pushing Changes

git
git push origin main
jj
jj git push
Command comparison: git commands on the left, jj commands on the right
gitjj
git push origin mainjj git push

Setting Up Remotes

git
git remote add origin https://github.com/user/repo.git
git remote -v
jj
jj git remote add origin https://github.com/user/repo.git
jj git remote list
Command comparison: git commands on the left, jj commands on the right
gitjj
git remote add origin https://github.com/user/repo.gitjj git remote add origin https://github.com/user/repo.git
git remote -vjj git remote list

Cloning Repositories

git
git clone https://github.com/user/repo.git
cd repo
jj
jj git clone https://github.com/user/repo.git
cd repo
Command comparison: git commands on the left, jj commands on the right
gitjj
git clone https://github.com/user/repo.gitjj git clone https://github.com/user/repo.git
cd repocd repo

Both create a git repository. To use jj:

cd repo
jj git init --colocate

Typical Remote Workflow

# 1. Fetch latest changes
jj git fetch

# 2. Rebase your work on top of remote
jj rebase -d main@origin

# 3. Make your changes
jj describe -m "New feature"
jj new

# 4. Push to remote
jj git push

Colocated Workflow

Since jj and git share the same .git directory:

# Use jj for daily work
jj status
jj log
jj describe -m "Work"
jj new

# Use git for remotes if needed
git push
git fetch

But it's better to use jj's git commands:

jj git fetch
jj git push

Handling Divergence

If your local and remote have diverged:

git
git pull --rebase
jj
jj git fetch
jj rebase -d main@origin
Command comparison: git commands on the left, jj commands on the right
gitjj
git pull --rebasejj git fetch

Multiple Remotes

git
git remote add upstream https://github.com/original/repo.git
git fetch upstream
jj
jj git remote add upstream https://github.com/original/repo.git
jj git fetch --remote upstream
Command comparison: git commands on the left, jj commands on the right
gitjj
git remote add upstream https://github.com/original/repo.gitjj git remote add upstream https://github.com/original/repo.git
git fetch upstreamjj git fetch --remote upstream

Git Compatibility

Since jj uses git's storage:

  • Use git GUI tools (GitHub Desktop, SourceTree, etc.)
  • CI/CD systems work unchanged
  • Host services (GitHub, GitLab) just see git

You get jj's UX with git's compatibility.

Try It Yourself

If you have a GitHub repository:

# Clone with jj
jj git clone git@github.com:user/repo.git
cd repo

# Initialize jj
jj git init --colocate

# Make a change
echo "test" > test.txt
jj describe -m "Add test"
jj new

# Push
jj git push

# Pull from another machine
jj git fetch
jj rebase -d main@origin

Key Takeaways

  • jj git fetch downloads remote changes
  • jj git push uploads local changes
  • jj rebase -d branch@origin pulls changes
  • Use @origin suffix for remote-tracking branches
  • jj and git can work on the same repo

Next Steps

Now let's learn about jj's powerful revset syntax for querying commits.

Try It Yourself

Loading terminal...

Progress stored locally · No account needed · Open source