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

Committing

Important

Where you get what it means that Jujutsu automatically commits.

Wait a sec. If @ represents the current file system:

@  x           empty
◆  z       🔒   empty

which is empty because your project is also empty, what happens if you add a file? Let’s see:

touch README.md
jj log
@  x
◆  z       🔒   empty

Interestingly, x is no longer empty. Git detects a new, untracked file:

git status
Changes not staged for commit:
        new file:   README.md

What’s Jujutsu’s opinion?

jj status
Working copy changes:
A README.md
Working copy  (@) : xmvkoxku b727840f (no description set)
Parent commit (@-): zzzzzzzz 00000000 (empty) (no description set)

Two things to notice:

  • Jujutsu automatically tracked the file (A README.md). In fact, there’s no equivalent of git add.
  • Easy to miss: the SHA1 changed.

Warning

Inspect x again. What’s in it?

Tip

It must contain README.md! In fact, x and your filesystem are one and the same: change either, and you change both.

jj show x
Commit ID: b727840fcbf04053c43d30b8581876260a240840
Change ID: xmvkoxkuvlrynmwooqtrxtxptmswruqq
Author   : Arialdo <arialdo@ik.me> (2026-06-09 16:10:17)
Committer: Arialdo <arialdo@ik.me> (2026-06-09 16:10:17)

    (no description set)

Added regular file README.md:
    (empty)

Oh dear! By creating a file, you performed a git commit --amend under the hood.

Warning

How do you add content to README.md and amend x again?

Tip

Just edit README.md!

echo "Hello, world" > README.md

jj show x
Commit ID: 126c51d1a7bddbd205721e64a0824233c68a56a0
Change ID: xmvkoxkuvlrynmwooqtrxtxptmswruqq
Author   : Arialdo <arialdo@ik.me> (2026-06-09 16:10:17)
Committer: Arialdo <arialdo@ik.me> (2026-06-09 16:13:12)

    (no description set)

Added regular file README.md:
        1: Hello, world

If you guessed right, bravo! In Jujutsu, the working directory and repository are the same area and always match. The lines:

Added regular file README.md:
        1: Hello, world

confirm x holds README.md with its content.
It’s yet another SHA1, but to Jujutsu, it’s still Change x.

The mental model is: editing the file system directly edits the commit. This may feel dangerous, but you will see some safer practices like the Squash Workflow later.

How Many Commits Have You Created and Abandoned Already?

Does it matter? Dangling commits are invisible to Git anyway. If you run git log, Git throws its hands up as though nothing happened:

git log
fatal: your current branch 'main' does not have any commits yet

For Git to see your commit, it needs a branch (a Bookmark, in Jujutsu’s lingo) pointing to it:

jj bookmark set main

Don’t worry, there’s a whole chapter on Bookmarks coming up. All in good time!