Skip to main content

to navigate · Press ? for help

Viewing History and Diffs

jj provides powerful tools for exploring history and comparing changes.

Viewing History

git
git log
jj
jj log
Command comparison: git commands on the left, jj commands on the right
gitjj
git logjj log

Log Options

git
git log --oneline
git log -n 10
git log --graph --oneline
jj
jj log -l 10
jj log --graph
jj log --all
Command comparison: git commands on the left, jj commands on the right
gitjj
git log --onelinejj log -l 10
git log -n 10jj log --graph
git log --graph --onelinejj log --all

Understanding the Log Output

In jj's log:

  • @ = Your working copy commit
  • = Regular commits
  • = Abandoned commits
  • @ appears in the log as the latest commit
$ jj log
@  xyzkpznx test 123
◉  prklqyso test foo
◉  roqmyuqs test bar
◉  yostqsxx qux

Viewing Commit Details

git
git show HEAD
jj
jj show @
Command comparison: git commands on the left, jj commands on the right
gitjj
git show HEADjj show @

Viewing Diffs

git
git diff
git diff app.js
git diff HEAD~1 HEAD
jj
jj diff
jj diff app.js
jj diff --from @- --to @
Command comparison: git commands on the left, jj commands on the right
gitjj
git diffjj diff
git diff app.jsjj diff app.js
git diff HEAD~1 HEADjj diff --from @- --to @

Diff Syntax

jj uses --from and --to for precise diff control:

# Compare @ with parent
jj diff --from @- --to @

# Compare two commits
jj diff --from abc --to def

# Compare with main
jj diff --from main --to @

# See what changed since main
jj diff --from main

Common Diff Patterns

What changed in my working copy?

jj diff

What's different between two branches?

jj diff --from main --to feature

Show me the changes in this commit:

jj show abc
# or
jj diff --from abc^- --to abc

What files are modified?

jj status

The Status Command

git
git status
jj
jj status
Command comparison: git commands on the left, jj commands on the right
gitjj
git statusjj status

Interactive History

jj's log is more than just text—it's an interactive history:

# View log with more details
jj log -v

# Show change IDs
jj log --change-id

# Show commit timestamps
jj log --timestamps

Comparing Files

git
git diff HEAD app.js
git diff branch1 branch2 app.js
jj
jj diff app.js
jj diff --from branch1 --to branch2 app.js
Command comparison: git commands on the left, jj commands on the right
gitjj
git diff HEAD app.jsjj diff app.js
git diff branch1 branch2 app.jsjj diff --from branch1 --to branch2 app.js

Operations Log

jj maintains an operation log—useful for undoing:

# Show operation history
jj op log

# Output:
# 0123 minutes ago: checkout
# 0456 minutes ago: new
# 0789 minutes ago: describe

Try It Yourself

# Make some changes
echo "test" > test.txt
echo "demo" > demo.txt

# See what changed
jj diff

# Commit them
jj describe -m "Add files"
jj new

# View the commit
jj show @-

# See history
jj log

# Compare with parent
jj diff --from @- --to @

Key Takeaways

  • jj log shows commit history with @ marking working copy
  • jj diff shows @ vs parent (use --from/--to for more)
  • jj show displays full commit details
  • jj status shows pending changes
  • jj op log shows operation history for undo

Next Steps

Now let's explore how jj handles remote operations differently from git.

Try It Yourself

Loading terminal...

Progress stored locally · No account needed · Open source