Skip to content

Instantly share code, notes, and snippets.

View jennings's full-sized avatar
🦄
What a mess I've made

Stephen Jennings jennings

🦄
What a mess I've made
View GitHub Profile
---
name: jujutsu
description: Use Jujutsu (jj) version control instead of git when working in a Jujutsu repository
match:
- directory_exists: .jj
---
# Jujutsu (jj) Version Control
This repository uses Jujutsu (jj), a modern version control system. **Use `jj`
@jennings
jennings / config.toml
Last active July 2, 2026 05:07
Pre-push “hook” for Jujutsu
[aliases]
push = ["util", "exec", "--", "bash", "-c", '''
jj run -r "remote_bookmarks()..$1" --no-edit \
-- pre-commit &&
jj git push -b "$1"
''', "jj-push"]
# usage:
# jj push my-bookmark
@jennings
jennings / jj-file-edit.md
Last active May 15, 2026 13:07
Prompts used to build `jj file set` and `jj file edit`

Environment:

  • Base commit: ff905ef4
  • Claude Code, Opus 4.7 for planning, Sonnet 4.6 for implementation

First prompt to add jj file edit:

Add a new command `jj file edit` which opens the user's editor with the
contents of a file at a particular revision. The command should take the
```
> jj spr diff --update-message
🛑 error decoding response body: unknown variant `Bot`,
expected one of `Mannequin`, `Team`, `User` at line 1
column 632
Error: External command exited with 1
```
jj-spr 1.3.6-beta.1

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.

General idea

Jujutsu should treat the change-id header as an opaque string. However, if the value happens to be formatted like a Jujutsu change ID (40 character reverse hex), then try to use it as the Jujutsu change ID as well.

If the community agrees to use jj's format, then everyone sees jj-style change IDs, and Jujutsu behaves as though they really are change IDs. If a competing format appears, jj can still use it to track amended commits but doesn't get confused and try to use it as the actual change ID.

// <PackageReference Include="Microsoft.TeamFoundationServer.Client" Version="19.239.0-preview" />
// <PackageReference Include="Microsoft.VisualStudio.Services.InteractiveClient" Version="19.239.0-preview" />
public class RetargetPullRequests
{
private readonly ILogger _log;
private readonly AzureDevOpsConfiguration _config;
private readonly GitHttpClient _gitClient;
public RetargetPullRequests(ILogger<RetargetPullRequests> log, IOptions<AzureDevOpsConfiguration> config, VssConnection connection)
@jennings
jennings / gist:9fe1432f394fc18a7eb0c2b2eab8dad3
Created August 23, 2024 20:55
Code reviews should have a single commit
When reviewing code, you should strive to review a single commit per review.
# How do I review a single commit?
If you are using pull requests, the branch you're reviewing should only have one commit to merge into the target branch.
# How do I address review feedback if I can only have one commit in my branch?
Make your changes and _amend_ the commit, then force push with `git push -f`.
@jennings
jennings / FirefoxColorSettings.md
Last active August 13, 2024 15:40
Firefox Color settings

Switching to Jujutsu workflows

When coming to Jujutsu, one may try to emulate their Git workflows directly. This is possible, but can cause a lot of difficulty.

This guide shows how to translate Git workflows to Jujutsu.

Getting started

Cloning an existing repository