vcs-detect

Detect jj or git version control in the current directory.

Updated Nov 3, 2019
One-click install
npx skills add https://github.com/gil0mendes/dotfiles --skill vcs-detect-gil0mendes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vcs-detect
Source: https://github.com/gil0mendes/dotfiles/tree/main/configs/opencode/skill/vcs-detect
Command: npx skills add https://github.com/gil0mendes/dotfiles --skill vcs-detect-gil0mendes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automatically detects whether a project uses Jujutsu (jj) or Git for version control, preventing command errors caused by using the wrong tool.

Core Features & Use Cases

  • Automatic VCS Detection: Identifies the active version control system (jj, git, or none).
  • Colocation Handling: Correctly prioritizes jj in repositories where both jj and git are present.
  • Use Case: Before running any status or log command, this skill ensures you use jj status for a jj repository and git status for a git repository, avoiding errors.

Quick Start

Run the vcs-detect skill to determine the version control system.

Frequently Asked Questions about vcs-detect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect the version control system in a project directory?

To detect the version control system, you can run a check that validates the presence of jj or git roots using `jj root` and `git rev-parse --show-toplevel`, returning which system is active. This prevents command errors caused by using the wrong tool.

Does Jujutsu work with colocated git repositories?

Yes, Jujutsu handles colocated repositories by correctly prioritizing jj over git when both are present in the same directory. This ensures you execute `jj status` instead of `git status` to avoid operational conflicts.

Why does my git command fail in a colocated jj repository?

Git commands fail in colocated jj repositories because the version control system needs proper detection to prioritize jj. Validating the active VCS root first ensures you use the correct command for the detected system.

What is the best way to check for jj or git before running status commands?

The best way to check for jj or git before running status commands is to validate the repository root using `jj root` and `git rev-parse --show-toplevel`. This identifies the active version control system to ensure correct execution.

Can I automatically switch between jj and git commands based on the directory?

Yes, you can automatically switch between jj and git commands by first detecting the active version control system in the directory. This ensures you execute the correct command, prioritizing jj in colocated repositories.

When do I need version control system detection for my developer tools?

You need version control system detection when working with developer tools in directories that might use either jj or git. Detecting the active VCS prevents command execution errors and ensures you interact with the correct repository system.