Git Workflow for Teams Using AI: How to Collaborate When AI Writes Most of the Code

The problem: When one person can generate 500 lines of code in 10 minutes using AI, your traditional PR review process collapses. Reviewers can’t keep up. Context gets lost. Here’s how teams are adapting.

The Old Git Workflow (Pre-AI)

Developer writes code (2-3 days)
  -> Opens PR (50-200 lines)
  -> Reviewer reads line by line (30 min)
  -> Comments and iterations (1-2 days)
  -> Merge

This worked when humans wrote 50-200 lines per PR. It breaks when AI generates 500-2000 lines per PR.

The New Git Workflow (AI-Enhanced)

Pattern 1: Atomic AI Commits

Instead of one giant PR, break AI-generated changes into logical commits:

feat: add user model and migration (AI-generated, human-reviewed)
feat: add auth endpoints (AI-generated, human-reviewed)
feat: add auth middleware (AI-generated, human-reviewed)
test: add auth test suite (AI-generated, human-verified)
style: apply project formatting conventions

Each commit is reviewable independently. Reviewer can focus on one logical unit at a time.

Pattern 2: Intent-First PR Descriptions

Old PR description: “Added login feature”

New PR description:

## Intent
Users need to log in with email+password and receive a JWT.

## Architecture Decision
Chose JWT over sessions because [reason].
Refresh token rotation for security.

## AI-Generated Code (Review Focus Areas)
- auth.controller.ts: Token generation logic (SECURITY-CRITICAL)
- auth.middleware.ts: Route protection (check edge cases)
- auth.test.ts: AI-generated tests (verify coverage is meaningful)

## Human-Written
- Migration files (schema decisions)
- Error messages (UX decisions)

This tells the reviewer WHERE to focus their limited attention.

Pattern 3: Two-Phase Review

  1. Architecture review (5 min) – Does the approach make sense? Right abstractions? Right patterns?
  2. Security/logic review (15 min) – Focus only on: auth, data validation, error handling, edge cases

Skip reviewing: formatting, boilerplate, imports, standard CRUD operations. AI gets these right 99% of the time.

Branch Strategy for AI-Heavy Development

main (protected)
  |
  +-- feature/user-auth (developer's branch)
       |
       +-- ai/auth-model (AI-generated, squash when reviewed)
       +-- ai/auth-endpoints (AI-generated, squash when reviewed)
       +-- human/auth-security-review (manual security hardening)

AI work goes into sub-branches that get squashed into the feature branch after review. Clean history.

Rules for AI-Generated Code in Teams

  1. Tag AI-generated commits – use [AI] prefix or a co-authored-by trailer
  2. Every AI generation needs a human reviewer – no direct merge to main
  3. Tests are mandatory – AI can write them, but a human must verify they test the right things
  4. Security-critical code gets manual review – auth, payments, data deletion
  5. Document the AI prompt – add the prompt as a comment in PR for context

Tools for AI + Git Collaboration

  • Claude Code – generates code with proper git commits
  • Cursor Composer – multi-file generation with diff view
  • GitHub Copilot PR Review – AI-assisted code review for AI-generated code
  • Graphite/Stacked PRs – break large AI changes into reviewable stacks

Practice team git workflows at hackathons on Reskilll

Scroll to Top