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

Creating a new commit

Reset your progress

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

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

When you're done with a set of changes, use jj commit to finalize them and start on a new task.

This command does two things:

  1. It opens a text editor for you to describe the commit you were just working on (@).
  2. It creates a new, empty working-copy commit for your next changes.
jj commit

Note for Git Users

Unlike git commit, which bundles changes into a new commit, jj commit adds a description to the existing working-copy commit and then creates a new empty one.

Writing a Good Commit Message

In the editor, write a description for your changes.

  • Subject: The first line should be a short summary (ideally under 50 characters) in the imperative mood (e.g., "Add user authentication" not "Added user authentication").
  • Body: After a blank line, you can add a more detailed explanation of the what and why behind your changes. Keep lines under 72 characters.
  • Comments: Lines starting with JJ: are helpful notes about your changes and are automatically removed from the final description.

Example:

Add readme with project title

It's common practice for software projects to include a README.md file
in their root directory.

The Result

After saving and closing the editor, jj log will show your previous commit with its new description, and a new empty commit (@) ready for your next changes.

@  pwpuwyto alice@local 2025-07-22 20:22:36 35de496a
│  (empty) (no description set)
○  mkmqlnox alice@local 2025-07-22 20:20:34 git_head() 5b79353a
│  Add readme with project title
◆  zzzzzzzz root() 00000000

This establishes the basic workflow for version control:

  1. Make some changes.
  2. Create a new commit