Repository is not clean. Please commit or stash any changes before updating

Issue Description

Angular CLI or Core update gives the below error,

Error: Repository is not clean. Please commit or stash any changes before updating. 

Repository is not clean Please commit or stash any changes before updating

The repository is not clean – Resolution

This error I found to be due to the git repository having uncommitted changes which could be due to a recent upgrade of important angular libraries.

To fix the issue, please run your command with –allow-dirty flag.

Example:

ng update @angular/cli @angular/core --allow-dirty

repository is not clean

This error is most common when you are trying to migrate from the old Angular framework.

This error is could also be reproducible in other scenarios.

This is a sort of warning to be extra careful if the changes aren’t committed before the update.

However, I had to run the command with an additional ‘–force’ flag to fix all other pending issues.

Run the above command with the –force command to fix any pending issue.

ng update @angular/cli @angular/core --allow-dirty --force

Repository is not clean Please commit or stash

See additional details here command –allow-dirty and –force

Build the project,

Repository is not clean Please commit or stash

Finally, The build is successful.

Reference:



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



10 thoughts on “Resolved: Repository is not clean. Please commit or stash

Leave a Reply

Your email address will not be published. Required fields are marked *