A tool to intelligently resolve merge conflicts in Jujutsu VCS. Port of git-mediate to C#.
$ dotnet add package jj-mediateA port of git-mediate to C# for use with Jujutsu VCS.
jj-mediate helps you resolve merge conflicts intelligently. When you have a 3-way merge conflict (showing base, side A, and side B), it can:
Given a diff3-style conflict:
<<<<<<< Side A
Modified by A
||||||| Base
Original
======= Side B
Modified by B
>>>>>>>
The algorithm detects:
For complex conflicts, it finds matching prefix/suffix lines and removes them to simplify the conflict.
# Install from NuGet
dotnet tool install -g jj-mediate
# Update to latest version
dotnet tool update -g jj-mediate
# Uninstall
dotnet tool uninstall -g jj-mediate
dotnet build -c Release
# Binary will be in jj-mediate/bin/Release/net10.0/
The repository includes PowerShell scripts for common development tasks:
# Format code
./format.ps1
# Check code formatting (lint)
./lint.ps1
# Build project
./build.ps1
# Run tests
./test.ps1
# Run full CI pipeline locally (lint + build + test)
./ci.ps1
Script Options:
build.ps1 -Configuration Debug - Build in Debug modetest.ps1 -Verbosity detailed - Run tests with detailed outputThis project uses Nerdbank.GitVersioning (nbgv) for automatic version management based on git history.
# Get current version
nbgv get-version
# Create a new version tag
git tag v1.0.0
git push origin v1.0.0
# Prepare next version
nbgv prepare-release
Version numbers are automatically calculated from:
version.json base versionRun unit tests:
# Run all tests
dotnet test
# Run with detailed output
dotnet test --verbosity normal
# Run in release mode
dotnet test --configuration Release
This project uses CSharpier for code formatting.
# Check formatting
dotnet csharpier check .
# Format code
dotnet csharpier format .
The project uses a unified CI/CD workflow (.github/workflows/ci-cd.yml) with multiple jobs:
On every push/PR:
On release:
NUGET_API_KEY secret)All jobs use nbgv for automatic version management.
Dependabot is configured to automatically check for updates to:
# Resolve conflicts in current jj repository
jj-mediate
# Resolve specific file
jj-mediate path/to/conflicted-file.cs
--trivial - Only resolve trivial conflicts (one side changed)--reduce - Reduce conflicts by removing common prefix/suffix--indentation - Handle indentation-only differences--added-lines - Detect lines added by both sides--line-endings - Normalize line endings (CRLF/LF)--untabify <width> - Expand tabs to spaces--split-markers - Split conflicts on ~~~~~~~ separators--show-diffs - Show diffs from base version-e, --editor - Open editor on remaining conflicts$ jj status
...
file.cs (conflicted)
...
$ jj-mediate
file.cs: Successfully resolved 3 conflicts (failed to resolve 1 conflict)
$ jj status
...
file.cs (conflicted) # Still has 1 unresolved conflict
...
jj commands instead of gitGPL-2.0 (same as original git-mediate)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License only.
See the LICENSE file for the complete license text.
Based on git-mediate by Eyal Lotem.