dmmulroy

vcs-detect

@dmmulroy/vcs-detect
dmmulroy
327
26 forks
Updated 1/18/2026
View on GitHub

Detect whether the current project uses jj (Jujutsu) or git for version control. Run this BEFORE any VCS command to use the correct tool.

Installation

$skills install @dmmulroy/vcs-detect
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Pathhome/.config/opencode/skill/vcs-detect/SKILL.md
Branchmain
Scoped Name@dmmulroy/vcs-detect

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

skills list

Skill Instructions


name: vcs-detect description: Detect whether the current project uses jj (Jujutsu) or git for version control. Run this BEFORE any VCS command to use the correct tool.

VCS Detection Skill

Detect the version control system in use before running any VCS commands.

Why This Matters

  • jj (Jujutsu) and git have different CLIs and workflows
  • Running git commands in a jj repo (or vice versa) causes errors
  • Some repos use jj with git colocated (both .jj/ and .git/ exist)

Detection Logic

Both jj root and git rev-parse --show-toplevel walk up the filesystem to find repo root.

Priority order:

  1. jj root succeeds → jj (handles colocated too)
  2. git rev-parse succeeds → git
  3. Both fail → no VCS

Detection Command

if jj root &>/dev/null; then echo "jj"
elif git rev-parse --show-toplevel &>/dev/null; then echo "git"
else echo "none"
fi

Command Mappings

Operationgitjj
Statusgit statusjj status
Loggit logjj log
Diffgit diffjj diff
Commitgit commitjj commit / jj describe
Branch listgit branchjj branch list
New branchgit checkout -b <name>jj branch create <name>
Pushgit pushjj git push
Pull/Fetchgit pull / git fetchjj git fetch
Rebasegit rebasejj rebase

Usage

Before any VCS operation:

  1. Run detection command
  2. Use appropriate CLI based on result
  3. If none, warn user directory is not version controlled

Example Integration

User: Show me the git log
Agent: [Runs detection] -> Result: jj
Agent: [Runs `jj log` instead of `git log`]

Colocated Repos

When both .jj/ and .git/ exist, the repo is "colocated":

  • jj manages the working copy
  • git is available for compatibility (GitHub, etc.)
  • Always prefer jj commands in colocated repos