If you have actually made alters to the same document in both your local copy the a Git repository and also a far repository, you’ll encounter the “commit your alters or stash them prior to you can merge” Git error.

You are watching: Repository is not clean. please commit or stash any changes before updating.


By continuing you agree come our terms of Service and also Privacy Policy, and also you consent to receive offers and opportunities from career Karma by telephone, message message, and email.

By proceeding you agree to our terms of Service and also Privacy Policy, and you consent to receive offers and also opportunities from job Karma by telephone, text message, and email.

In this guide, we talk about what this error means and why it may be raised. We discuss the three ways in i m sorry you deserve to solve this error.

commit your changes or stash them prior to you deserve to merge

Because Git is distributed, you can maintain multiple duplicates of a repository. This method you deserve to have one variation of a repository ~ above one computer, an additional version on one more computer, and one central version to which every copy refers.

It is feasible for the remote (central) version of a repository to change before you push a readjust to a repository. If someone transforms the main version that a repository, you must pull a local copy so you can work through the most up-to-date variation of the codebase.

If the updated version of the repository has a adjust to a paper that conflicts with a readjust you have made ~ above your neighborhood machine, you’ll watch an error. This is because Git is unsure whether the remote variation or the neighborhood version of the adjust should it is in kept.

The Solution

This error is designed as a safeguard. Before you can push her code, Git pressures you to think around which variation of a file you want to keep: the neighborhood one, or the one in the remote variation of the repository.

There are three methods you can solve this error:

Commit a adjusted fileDiscard her changesStash her changes
» MORE: Git fatal: ‘origin’ does not appear to it is in a git repository Solution

Solution #1: go a adjusted File

You desire to walk the changed document if your neighborhood copy that the record is the one you desire to store in the repository. This will include your file to the Git go record and also make it part of the background of the project.

See more: The Jesus Take The Wheel Kirk Franklin, Kirk Franklin

81% of participants proclaimed they felt an ext confident around their tech project prospects after ~ attending a bootcamp. Acquire matched come a bootcamp today.