# Angular CLI: Repository is not clean. Please commit or stash any changes before updating.

**Code:** `Repository is not clean` · **Category:** Angular · **Seen on:** Angular, Angular CLI, Git

`ng update` refuses to run because git has uncommitted changes; it wants every migration to be a reviewable diff.

## Meaning

Angular's update schematics edit many files. To keep the changes reviewable and reversible, the CLI requires a clean working tree. Commit or stash first, or pass `--allow-dirty` if you really want to proceed.

## Common causes

- Uncommitted or untracked files in the repository
- Modified `package-lock.json` or build output not ignored
- Generated files missing from `.gitignore`
- Running the command in a monorepo root with unrelated changes

## Quick fix

1. Commit or stash: `git add -A && git commit -m "before ng update"`
2. Ignore build output in `.gitignore`
3. Use `--allow-dirty` only when you accept the risk

## Detailed fix by platform

### Linux

1. `git status` to see what is dirty; `git stash -u` to set changes aside, then `ng update` and `git stash pop`

### Angular CLI

1. `ng update @angular/core @angular/cli --allow-dirty` (not recommended)

## How to diagnose

1. **Status** — What does git status list?
2. **Ignore** — Are generated files ignored?
3. **Risk** — Can you commit first?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/angular/update-repository-not-clean)
