Logo di Using Git Worktrees

Using Git Worktrees

Community
andreaswasita
using-git-worktrees

Isolates each task in its own git worktree off main.

Panoramica

Autoreandreaswasita
Repositorycopilot-agents-dojo
Nome della skillusing-git-worktrees
Stelle
54
Fork
15
File inclusi
Solo istruzioni
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da andreaswasita su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Using Git Worktrees in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/andreaswasita/copilot-agents-dojo/tree/main/skills/using-git-worktrees
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/andreaswasita/copilot-agents-dojo.git /tmp/copilot-agents-dojo
mkdir -p .claude/skills
cp -r /tmp/copilot-agents-dojo/skills/using-git-worktrees .claude/skills/using-git-worktrees
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Using Git Worktrees in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Using Git Worktrees non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Using Git Worktrees non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Using Git Worktrees Skill

Creates an isolated git worktree on a dedicated feature branch for every development task, so main is never touched until finishing-a-development-branch says so. Does NOT replace feature branches when worktrees are impractical (CI, single-file fix) — the isolation principle is what matters.

When to Use

  • Starting any non-trivial development task (default behavior).
  • Before the agent would otherwise modify code on main.
  • When parallel development tracks are needed (multiple worktrees in flight).
  • After brainstorming produces an approved design.
  • NOT for a one-line typo fix where a branch is sufficient.

Prerequisites

  • git ≥ 2.5 with worktree support.
  • The repository is already cloned (a worktree extends an existing clone).
  • The powershell Copilot tool to run git.
  • A naming convention agreed for the branch: feature/*, fix/*, experiment/*.
  • The project's dependency install command (npm install, pip install -r requirements.txt, etc.).

How to Run

text
1. From the main repo root, create the worktree with a new branch.
2. Change into the worktree directory.
3. Install dependencies inside it.
4. Confirm a green test baseline.
5. Work only inside the worktree — never touch the main worktree.

Quick Reference

OperationCommand
Creategit worktree add ../<dirname> -b <branch>
Listgit worktree list
Removegit worktree remove ../<dirname>
Prune stalegit worktree prune
Branch prefixUse
feature/<slug>New features
fix/<slug>Bug fixes
experiment/<slug>Spikes / throwaway
Dependency bootstrapDetect signal
npm installpackage.json
pip install -r requirements.txtrequirements.txt
go mod downloadgo.mod
mvn dependency:resolvepom.xml
dotnet restore*.csproj

Procedure

Step 1: Create the Worktree

From the main repo root, run via the powershell tool:

bash
git worktree add ../project-feature-name -b feature/feature-name
cd ../project-feature-name

Use a directory name that is obviously not the main repo so you cannot edit the wrong one by accident.

Step 2: Install Dependencies

Detect the stack from the table above and run the matching install command. A worktree shares .git, not node_modules / .venv / build artifacts.

Step 3: Establish a Green Baseline

Run the project's test command via the powershell tool. Capture pass/fail counts before changing any code. If the baseline is red, fix it first or explicitly acknowledge the broken tests in tasks/todo.md.

bash
git status --porcelain         # must be empty
git branch --show-current      # must be the new feature branch
<project test command>         # must exit 0 for a clean baseline

Step 4: Work Inside the Worktree

All commits go to the feature branch. The main repo's working tree is read-only for the duration. Open files and run commands only from inside the worktree directory.

Step 5: When Worktrees Are Impractical

For CI environments, single-file fixes, or systems without worktree support:

bash
git checkout -b feature/<slug>

The isolation principle still applies: never commit to main.

Step 6: Cleanup (handled later)

Worktree teardown is owned by finishing-a-development-branch. Do not remove the worktree mid-task.

Pitfalls

  • DO NOT commit to main. Not even once. That is how production breaks.
  • DO NOT reuse a stale worktree from a prior task. Create a fresh one.
  • DO NOT skip the baseline test run. Unknown baseline = unverifiable changes.
  • DO NOT leave orphaned worktrees behind. git worktree list to audit; cleanup belongs to the finishing skill.
  • DO NOT edit files across multiple worktrees in one task. One worktree, one task.

Verification

  • git worktree list shows the new worktree.
  • Current directory matches the worktree path; current branch is the new feature branch.
  • Dependencies installed inside the worktree.
  • Test baseline captured (counts recorded in tasks/todo.md).
  • git status --porcelain was empty before the first code change.

Domande frequenti

Cosa fa la skill IA Using Git Worktrees?

Isolates each task in its own git worktree off main.

Perché usare Using Git Worktrees su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Using Git Worktrees è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Using Git Worktrees in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/andreaswasita/copilot-agents-dojo/tree/main/skills/using-git-worktrees. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Using Git Worktrees?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Using Git Worktrees?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Using Git Worktrees: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Using Git Worktrees è gratuita?

Sì. È pubblicata su GitHub da andreaswasita con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇