Skip to main content

to navigate · Press ? for help

Mental Model: Working Copy as a Commit

The biggest difference between git and jj is how they think about your working copy.

In git: Three States

Git has three separate states for your code:

  1. Working copy - Your actual files on disk
  2. Staging area - Changes ready to commit
  3. Repository - Committed snapshots
# git workflow
git status      # Check working copy
git add file    # Move to staging
git commit      # Move to repository

In jj: Two States

jj combines the working copy and the repository. Your working copy is a commit.

  1. Working copy - Represented by the @ commit
  2. Repository - All other commits
# jj workflow
jj status      # Check the @ commit
jj describe    # Name the @ commit
jj new         # Create a new @ commit

The @ Commit

In jj, your uncommitted changes are represented by the @ commit. It's a real commit that exists in the repository.

git
git status
git diff src/app.ts
jj
jj status
jj show @
Command comparison: git commands on the left, jj commands on the right
gitjj
git statusjj status
git diff src/app.tsjj show @

No Staging Area

Since your working copy is already a commit, there's no staging area.

git
git add app.ts
git add test.ts
git commit -m "Fix bug"
jj
jj describe -m "Fix bug"
jj new
Command comparison: git commands on the left, jj commands on the right
gitjj
git add app.tsjj describe -m "Fix bug"
git add test.tsjj new
git commit -m "Fix bug"
NOTE:

In jj, all file changes are automatically tracked. There's no need to jj add files—your changes are already part of the @ commit.

Practical Example

Let's say you're working on a feature and want to commit your changes.

Git workflow
vim src/app.ts
git status
git add src/app.ts
git commit -m "Add feature"
jj workflow
vim src/app.ts
jj status
jj describe -m "Add feature"
jj new
Command comparison: Git workflow commands on the left, jj workflow commands on the right
Git workflowjj workflow
vim src/app.tsvim src/app.ts
git statusjj status
git add src/app.tsjj describe -m "Add feature"
git commit -m "Add feature"jj new

Why This Matters

The @ commit model enables several jj features:

  • Instant undo - jj op undo reverses any operation
  • Edit old commits - No separate "staging" to conflict with
  • Automatic rebasing - Clear lineage between commits
  • First-class conflicts - Conflicts live in commits, not separate files

Visualization

Git state
[Working Copy] → [Staging] → [Repository]
jj state
[@ Commit] → [Repository]
Command comparison: Git state commands on the left, jj state commands on the right
Git statejj state
[Working Copy] → [Staging] → [Repository][@ Commit] → [Repository]

Try It Yourself

Explore the @ commit:

# Show the current @ commit
jj show @

# Show changes in @
jj diff

# Rename the @ commit
jj describe -m "Working on feature"

# See all commits including @
jj log

Key Takeaways

  • Your working copy in jj is the @ commit
  • No staging area—all changes are auto-tracked
  • jj describe names the @ commit
  • jj new finalizes @ and creates a new one

Next Steps

Now that you understand the mental model, let's look at creating your first commits in jj.

Try It Yourself

Loading terminal...

Progress stored locally · No account needed · Open source