Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cloning a remote

Reset your progress

To reset your progress to the start of this chapter, run the following command:

curl https://jj-for-everyone.github.io/reset.sh | bash -s clone
cd ~/jj-tutorial/repo

In order to drive home the point that the remote repository functions as a backup, we're now going to completely delete our main repository and restore it from the remote. First, the deletion:

cd ~
rm -rf ~/jj-tutorial/repo

The next step is restoring the repo, but you can also think of it in a different way. Imagine there is an ongoing project and you have just joined the team. In order to contribute changes to the project, you first need to get a copy of it on your own computer. The process to do that with Jujutsu is the exact same process as restoring the project from a backup remote. Here's the command:

jj git clone ~/jj-tutorial/remote ~/jj-tutorial/repo

The last two arguments are (1) the source from which to clone and (2) the destination - where to store the copied repo. When you clone from a remote, you're automatically connected to it with the default name origin. We'll also need to recreate our repo-specific authorship configuration:

cd ~/jj-tutorial/repo
jj config set --repo user.name "Alice"
jj config set --repo user.email "alice@local"
jj metaedit --update-author

Let's run jj log in our fresh clone to see if we restored the repo successfully:

@  kxqyrwux alice@local 2025-07-22 20:32:47 7efef483(empty) (no description set)
  mkmqlnox alice@local 2025-07-22 20:25:40 main git_head() 7939d4cf
│  Add readme with project title
~

This looks mostly right, but there are little differences. We can't see the root commit anymore and our commit is marked with a diamond, instead of a circle like before. As mentioned, the diamond and circle markers are related to a feature we'll learn about later. For now, we can say that ancestors of diamond commits are hidden by default, because you won't care about them most of the time. We can tell Jujutsu to show us all commits with jj log --revisions 'all()':

@  kxqyrwux alice@local 2025-07-22 20:32:47 7efef483(empty) (no description set)
  mkmqlnox alice@local 2025-07-22 20:25:40 main git_head() 7939d4cf
│  Add readme with project title
  zzzzzzzz root() 00000000

Great! Now we can be sure our repository was fully restored from the remote.