Jujutsu GitHub Guide
This is a guide to common Jujutsu workflows with GitHub. It assumes that you have already installed the GitHub cli (gh
) and git
and Jujutsu (jj
).
Create Repository and initial push
Section titled “Create Repository and initial push”Start in the directory where you have the code you want to push to GitHub.
If you haven’t already done so, create the local git repository:
git init .
Create the remote repository:
gh repo create --public --source=. --remote=origin **repo-name**
Create the Jujutsu repository:
jj git init --colocateecho .jj/ >> .gitignore
If (and only if) you created the Jujutsu repository before setting the remote, you will have to tell Jujutsu about it.
jj git remote add origin git@github:**username**/**repo-name**.git
Now do whatever work you want to prepare for the initial push. You can make as many local commits as you want with this command:
jj ci # edit commit message and create a new changeset
When you are finally ready to share your changes, set the main
bookmark (or whatever branch name you consider the main line of development):
jj bookmark set main -r @-
-r @-
is a reference to the penultimate changeset—the one you just edited the description for.
Finally, you can throw it over the wall:
jj git push --allow-new
Subsequent pushes use the same three commands, but drop --allow-new
:
jj ci #edit commit message and create new changesetjj bookmark set main -r @-jj git push
Again, you can repeat the first command as many times as you want between pushes. This workflow is appropriate in the initial stages of project when you are making frequent changes directly to the primary development branch.
Feature Branches with Pull Requests
Section titled “Feature Branches with Pull Requests”This is a different can of worms that I have not figured out yet.