Committing
Wait a sec. If @ represents the current file system:
$ jj log
@ x empty
◆ z 🔒 empty
which is empty because you have no file in your project yet, what
happens if you make any change to the disk so the project is not empty
anymore? That's an excellent question, and you could already guess the
answer. Try creating an empty README.md:
$ touch README.md
$ jj log
@ x
◆ z 🔒 empty
Interestingly, x is not marked as empty anymore. If you ask Git,
it will detect that there is a new, untracked file:
$ git status
No commits yet
Changes not staged for commit:
new file: README.md
no changes added to commit.
What's Jujutsu's opinion on the status?
$ 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 has already added the file (
A README.md). It's not untracked. Unlike Git, new files are automatically tracked. There's no equivalent ofgit add. - Easy to miss: the SHA1 has changed.
Inspect x again. Will it be empty?
Solution
Solution
Of course it's not! x must contain README.md now. 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)
Notice the:
Added regular file README.md
Oh dear! Just
creating a file, you have in fact performed a git commit --amend.
Here's the final challenge. How would you add some content to README.md
and amend x again?
Solution
Solution
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 it right, bravo! In Jujutsu the working directory and the repository are just the same area, and they are always matching. The lines:
Added regular file README.md:
1: Hello, world
confirm that x holds README.md with its content.
It's yet another SHA1: under the hood, there was another git commit --amend, while from Jujutsu's perspective, it's still the Change x.
You learned that already, didn't you?
The mental model I suggest is: by editing the file system, you are directly editing the commit. We will soon see how this is somewhat dangerous and how we can protect ourselves with better workflows like the Squash Workflow.
How Many Commits Have You Created and Abandoned, Already?
Does it matter? Those dangling commits are invisible to Git anyway. If
you run git log, Git still throws its hands up, as though nothing
has happened yet:
$ git log
fatal: your current branch 'main' does not have any commits yet
Those commits are real, but since they are not targeted by any branch,
they won't get in your way. When using Jujutsu you can keep calling
that Change x and forget about the low-level minutiae. That's why my
log template doesn't even bother to print the Git SHA1: most of the
time, it's just irrelevant.
For Git to see your commit, it needs a branch (bookmark, in Jujutsu's lingo) targeting it. Add one with:
jj bookmark set main
No need to worry; there's a whole chapter on bookmarks ahead. All in good time!