Leanpub Header

Skip to main content

Git in the Age of AI Agents.

The Operational Playbook for Coordinating Engineers, Agents, and Subagents Without Losing Control of Your Application

AI agents can produce code faster than teams can safely review and integrate it. This practical playbook shows how to use Git, branches, worktrees, prompts, safeguards, and recovery procedures to coordinate engineers, agents, and subagents without losing control of your application.

Free With Membership
This book is a translation into English of Construire Tansa avec l’IA which was originally written in French

With Membership

Free!

$14.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

AI agents are changing software development. A single engineer can now coordinate several agents and subagents working simultaneously across an application. This dramatically increases production capacity—but it also multiplies branches, worktrees, uncommitted changes, conflicts, migrations, generated files, and potentially destructive Git operations.

Git in the Age of AI Agents is not another introduction to Git. It is an operational guide for teams that already use Git and now need to remain in control while humans and AI agents modify the same project.

The book explains how to define a safe working perimeter for every agent, isolate concurrent tasks with branches and worktrees, inspect repository state before any mutation, create reviewable commits, integrate parallel work, protect shared history, and recover from incidents without destroying valuable evidence.

Every important Git command is explained before the reader is asked to execute it: what it reads or changes, why it is needed, what output to expect, its level of risk, and how to stop or recover when the observed state differs from the approved state.

Each operational chapter contains:

  • a real engineering problem;
  • an emergency response;
  • a detailed procedure;
  • explained Git commands;
  • reusable prompts for AI agents;
  • common mistakes and warning signs;
  • decision points requiring human approval;
  • a final checklist;
  • a team-ready deliverable.

The book also addresses difficult situations: overlapping agent modifications, lost commits, unsafe rebases, force pushes, damaged main branches, uncontrolled worktrees, migration conflicts, secrets, generated files, production incidents, and repositories that no longer represent the expected application.

Examples inspired by the development of Tansa, a real multi-agent application, show how technically valid Git operations can still produce a functionally incorrect result—and how clear authority, preserved evidence, and disciplined recovery procedures can prevent a difficult situation from becoming a disaster.

This book is designed to be opened at the moment a problem occurs. Readers can follow the emergency section first, apply the procedure, and then study the deeper explanations when the repository is safe again.

Who This Book Is For

  • Software engineers working with AI coding agents
  • Technical leads coordinating concurrent development
  • Teams using agents and subagents on the same repository
  • Engineering managers defining safe Git policies
  • Developers responsible for recovering damaged repositories
  • Organizations introducing AI-assisted development at scale

Share this book

Categories

This book is a translation into English of Construire Tansa avec l’IA which was originally written in French

Author

About the Author

Victor PEREZ

Victor Perez is an independent author whose books explore a wide variety of subjects and genres. He writes about the ideas, questions, and experiences that fascinate him—from technology, artificial intelligence, Bitcoin, and software architecture to philosophy, spirituality, human freedom, and personal transformation.

His goal is not to confine himself to a single field, but to make complex subjects clear and engaging without oversimplifying them. Whether he is documenting a real-world project, examining a philosophical question, or exploring a spiritual tradition, he approaches each book with curiosity, honesty, and a desire to invite readers to think for themselves.

Alongside his writing, he designs and develops Tansa, a Bitcoin analytics application built with Ruby on Rails, PostgreSQL, and artificial intelligence.

Translations

Translations

Languages

Contents

Table of Contents

  • Part 0 — Book Contract
  • Part I — What Agents Change About Using Git
    • Chapter 1 — When a Developer Becomes Responsible for Multiple Code Producers
    • Chapter 2 — Why Git Does Not Automatically Coordinate Agents
    • Chapter 3 — Repository, Working Tree, Index, Commit, and Application
    • Chapter 4 — The Four New Categories of Risk
    • Chapter 5 — What Git Protects—and What It Does Not
  • Part II — Preparing a Repository for Multi-Agent Work
    • Chapter 6 — Capture the Project’s Initial State
    • Chapter 7 — Identify the Reference Branch and Commit
    • Chapter 8 — Protect Existing Work
    • Chapter 9 — Create One Worktree per Task
    • Chapter 10 — Define Allowed and Forbidden Paths
    • Chapter 11 — Reserve Sensitive Components
    • Chapter 12 — Prepare Rules Agents Can Read
  • Part III — Assigning a Git Task to an Agent
    • Chapter 13 — The Task Contract
    • Chapter 14 — Pin the Starting Point
    • Chapter 15 — Limit Authorized Changes
    • Chapter 16 — Authorize or Prohibit Subagents
    • Chapter 17 — Require Small, Intentional Commits
    • Chapter 18 — Link Tests to the Delivered Commit
    • Chapter 19 — Obtain an End-of-Task Report
    • Chapter 20 — Stop an Obsolete Task
  • Part IV — Coordinating Agents and Subagents
    • Chapter 21 — One Branch, One Worktree, and One Owner per Task
    • Chapter 22 — Detect Overlaps Before Development Starts
    • Chapter 23 — Manage Dependencies Between Tasks
    • Chapter 24 — Serialize Work That Cannot Be Parallelized
    • Chapter 25 — Migrations and Shared Contracts
    • Chapter 26 — Generated Files and Lockfiles
    • Chapter 27 — Know When to Reduce Parallelism
  • Part V — Integrating Agent-Generated Code
    • Chapter 28 — Review an Agent’s Diff
    • Chapter 29 — Verify the Actual Modified Scope
    • Chapter 30 — Verify Code Provenance
    • Chapter 31 — Update a Long-Running Task
    • Chapter 32 — Test a Change in Isolation
    • Chapter 33 — Test the Combined Result
    • Chapter 34 — Organize a Merge Queue
    • Chapter 35 — Protect the Main Branch
    • Chapter 36 — Publish Without Rewriting Shared History
  • Part VI — Communicating with AI About Git
    • Chapter 37 — The Observation Prompt
    • Chapter 38 — Explain Authorized Commands
    • Chapter 39 — Prohibit Destructive Commands
    • Chapter 40 — The Limited-Intervention Prompt
    • Chapter 41 — Control Delegation to Subagents
    • Chapter 42 — Request a Diagnosis Without Requesting a Repair
    • Chapter 43 — Organize Refusal and Escalation
    • Chapter 44 — A Library of Git Prompts
  • Part VII — Dangerous Operations
    • Chapter 45 — Understand Reset, Restore, and Revert
    • Chapter 46 — Understand the Risks of Clean
    • Chapter 47 — Understand Stash in a Multi-Agent Environment
    • Chapter 48 — Rebase Without Losing Provenance
    • Chapter 49 — Why Force Push Remains Exceptional
    • Chapter 50 — Remove a Worktree Without Deleting Unknown Work
  • Part VIII — Recovering from a Critical Situation
    • Chapter 51 — The First Ten Minutes
    • Chapter 52 — Freeze Writes
    • Chapter 53 — Inventory Every State
    • Chapter 54 — Reconstruct the Timeline
    • Chapter 55 — Recover a Commit with Reflog
    • Chapter 56 — Test a Recovery in a Separate Worktree
    • Chapter 57 — Distinguish Git Recovery from Application Recovery
    • Chapter 58 — Align Code, Migrations, Data, and Configuration
    • Chapter 59 — Promote a Recovery Without Force Push
    • Chapter 60 — Produce the Incident Report
  • Part IX — Establishing the Method Across the Team
    • Chapter 61 — The Engineer’s Daily Protocol
    • Chapter 62 — The Task Dashboard
    • Chapter 63 — Repository Protection Rules
    • Chapter 64 — Recovery Exercises
    • Chapter 65 — Build the Organization’s Playbook
  • Appendices
    • Sources and Official Documentation
    • Matrix of Risk Levels
    • Minimum Contract Model

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub