Skip to content

Instantly share code, notes, and snippets.

@jennings
Created April 21, 2025 17:55
Show Gist options
  • Save jennings/2862acfb7e4a262341dfc4a2e04a60bf to your computer and use it in GitHub Desktop.
Save jennings/2862acfb7e4a262341dfc4a2e04a60bf to your computer and use it in GitHub Desktop.

Staging changes with Jujutsu

Concern

I use the Git index (staging area). This is an important part of my workflow and I cannot use a version control system that doesn't have it.

Underlying need

The Git index is used to build up the next commit. Your working copy may have many files unrelated to the change you want to commit.

The underlying need is to:

  • Build up a commit from a subset of changes in the working copy
  • ...

Jujutsu uses commits as the staging area

Instead of a different data structure, Jujutsu uses commits as the staging area.

To start work, create two new revisions:

$ jj new -m "My new feature"
$ jj new

As you change files, the changes are added to the second commit.

To build up the commit, squash changes into the first commit:

$ jj squash -i

This opens the diff editor and lets you choose which changes you want to move into the first commit.

Uncommitted changes

Concern

It seems like automatically committing all changes is a problem. What if you don't want to commit something? What if you accidentally commit passwords?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment