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.
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
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
See additional details here command –allow-dirty and –force
Build the project,
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.
thanks! it works..
thnx for exact solution
Thanks Veeru. Glad it helped you!
worked for me as well!! Thanks 🙂
Thanks. You are welcome!
Perfect . Thank you .. it worked with flag – – force.
Thanks Adrian.
Worked for me . Thank you !!
Thanks Ethan. Appreciate your comments and feedback!
Thanks .Had this exact issue while upgrading angular 4 to 8.0.3.