Jujutsu


1 Introduction

Jujutsu's main advantage for us is the fact that basically it's rebasing everything all the time for you (whenever you edit stuff in the history, the commits on top get rebased). So it saves a couple steps and is generally faster than using raw Git if you're constantly fixing up your work.

One disadvantage though is that it does not work well with Melby (a shell prompt generator which aggressively queries Git for changes), whenever there is a merge conflict. It's most definitely Melby's fault, not Jujutsu's, but it's something that we need to fix (we first need to rewrite Melby to be less complicated, but that's for another day).

2 Configuration

🎯 jj/config.toml
user
aliases
revset-aliases
lazyjj
templates
colors
ui

2.1 User

user
[user]
"name" = "Linus Arver"
"email" = "linus@ucla.edu"

2.2 Aliases

aliases
[aliases]
sync = ["rebase", "-b", 'all:trunk()..(visible_heads() ~ (immutable_heads() | remote_bookmarks()) | branches())', "-d", "main"]

2.3 Revset aliases

Jujutsu always complains when you try to modify commits that have already been pushed up, requiring us to provide the rather long --ignore-immutable flag. This is super annoying (especially on branches where it's expected to be overwritten frequently), so disable it completely. We already use Git to push branches up anyway (Git will block overwriting already-pushed commits by requiring a force push with -f), so this is safe enough.

revset-aliases
[revset-aliases]
"immutable_heads()" = "none()"

2.4 lazyjj

lazyjj
[lazyjj]
layout = "vertical"

2.5 Templates

templates
[templates]
draft_commit_description = '''
concat(
  coalesce(description, default_commit_description, "\n"),
  if(
    description.contains("Signed-off-by:"),
    "",
    concat(
      "\nSigned-off-by: ",
      self.author().name(),
      " <",
      self.author().email(),
      ">"
    )
  ),
  "\n\n",
  "JJ: --------------------------------------------------------------------\n",
  "JJ: ignore-rest\n",
  surround(
    "#+begin_src txt\n", "#+end_src\n",
    indent("    ", diff.stat(72)),
  ),
  "#+begin_src diff\n",
  diff.git(),
  "#+end_src\n",
)
'''

2.6 Colors

colors
[colors]
# Diff chunks.
"diff added token" = { fg = "#335533", bg = "#ccffcc", bold = true, underline = false }
"diff removed token" = { fg = "#553333", bg = "#ffcccc", bold = true, underline = false  }

# There are for the line numbers in the left margin, next to the diff chunk lines.
"diff added" = { fg = "#ccffcc", bold = true }
"diff removed" = { fg = "#ffcccc", bold = true }

2.7 UI

ui
[ui]
conflict-marker-style = "git"
merge-editor = "meld"

Page metrics

Tangled files (1)

  1. jj/config.toml

Named cells (7)

  1. aliases
  2. colors
  3. lazyjj
  4. revset-aliases
  5. templates
  6. ui
  7. user