What is Jujutsu?
Jujutsu (jj) is a Git-compatible version control system that provides a simpler and more powerful interface than Git. Since it maintains compatibility with Git repositories, you can use git-cliff to generate changelogs from Jujutsu-managed repositories.Colocated repositories
If you cloned your repository using Jujutsu with the--colocate option, git-cliff works out of the box with minimal configuration.
Setup
The--colocate option creates both .git and .jj directories, allowing both Git and Jujutsu to operate on the same repository:
Running git-cliff
Make sure you have checked out your mainline branch using Git:Non-colocated repositories
When you clone a repository with Jujutsu without the--colocate option, the Git repository is stored in .jj/repo/store/git instead of the standard .git directory.
Configuration steps
- Clone the repository:
- Create a
.gitfile pointing to the Jujutsu Git store:
- Update HEAD to point to your main remote branch:
Replace
main with the name of your main remote branch if it’s different (e.g., master, trunk, develop).- Run git-cliff:
Complete example
Here’s a complete workflow for using git-cliff with a non-colocated Jujutsu repository:Workflow integration
Automated changelog generation
Add a script to automate the setup and changelog generation:scripts/generate-changelog.sh:
Pre-release workflow
Combine Jujutsu’s powerful commit management with git-cliff:Troubleshooting
Error: “unborn branch”
Problem: git-cliff reports an error about an unborn branch. Solution: Ensure HEAD points to a valid branch:Error: “not a git repository”
Problem: git-cliff cannot find the Git repository. Solution: Create the.git file pointing to Jujutsu’s Git store:
Missing commits
Problem: Recent Jujutsu commits don’t appear in the changelog. Solution: Export Jujutsu commits to Git:Best practices
-
Always export before generating: Run
jj git exportbefore generating changelogs to ensure all Jujutsu commits are available to git-cliff. -
Automate setup: Use a script to automatically configure the
.gitfile and HEAD reference for non-colocated repositories. - Use conventional commits: Jujutsu makes it easy to edit commit messages. Take advantage of this to ensure they follow conventional commit format:
- Leverage Jujutsu’s history editing: Before generating a changelog, use Jujutsu’s powerful history editing features to clean up commits: