I think this problem is caused by EGit version. When I used Spring Tools Suite with EGit 2.6, I also faced same problems.

EGit is included in STS Default package, so EGit upgrade is very difficult.

Currently I am using eclipse WTP with EGit 3.7, this problem is disappeared.


In eclipse I went to Team Synchronizing View and from there right clicked on my project and hit 'overwrite' to overwrite all local changes. Then retry your merge.


Only to add another case, I've got DIRTY_WORKTREE, I'm the only one commiting to my Github project, so in EGit I did a Push branch... with "Force overwrite of branch on remote if it exists and has diverged"

DANGER: If other are working on the same project, this action will delete their commits since divergence.


I had similar problem on Eclipse with uncommited changes as ununiform. After a commited I could merge and everything is back as it should be. Take a look at your source code and check any changes. If none you can reset hard.


Delete the affected files and try to pull again. Thereafter push your changes to the git. I has the same issue and this worked for me.


In my case, the DIRTY_WORKTREE was caused by this sequence:

  1. In a commit, I committed also some files that I should have ignored
  2. In the next commit I modified the .gitignore that ignore the above files
  3. Try to rebase on top of another branch where my change to .gitignore is missing

In this scenario, Eclipse thinks your working tree is dirty. Indeed, it is not obvious comparing two filesets when one of the two is ignoring some files and the other is not.

To solve the issue in Eclipse, I did the following:

  • Modify the .gitignore so it is the same as the one in the branch I want to rebase on
  • Happily start the rebasing or rebasing with merge.


If you have changes without commiting, eclipse will advise you if you try to pull changes. To solve it, you can discard the changes or do the commit of these files.



If you want to override you local branch to the origin branch.

Go to Git repo view> click on origin master> Choose reset ->it will show current HEAD and resetting to branch. Choose HARD reset, if you want to completely overwrite your local changes


Just delete the .gitignore present in the project folder, and then merge. The merge will show conflicts , which you need to resolve and then push the changes.


It seems to mean that the version you are on now has edits that are not yet committed. So you either have to remove these edits, or commit them. Notice that if you commit them you may get merge conflicts.


This error is happening when you have made local changes to files that haven't been committed yet. In git's parlance, you have uncommitted changes in your working tree.

When you are in this situation and you try to pull, git is not sure what to do with the local changes you have. Should it discard those and pull the changes from the remote? Should it commit those before pulling the changes from the remote? That's why it fails.

To avoid this problem before you pull changes into your local repository you either have to commit your local changes, stash them, or discard them. Once you don't have pending local changes in your working tree, you should be able to pull with no errors.


I had uncommitted changes. After I committed them, then merged, the dirty worktree issue disappeared.


Another approach, if you don't have any work in progress, is to try and reset --hard your HEAD.

With EGit: Resetting your current HEAD:

Select Team -> Reset... on a project. This opens a dialog where you can select a branch or a tag.

Reset HEAD on your current branch, in order to reset index and working tree to the last commit of said branch.

Then try your pull.


I was able to fix a similar issue by using the git command line client. While eclipse (egit) was only saying DIRTY_WORKTREE, in the command line I saw multiple conflicting files. Using git merge master from the command line, I could easily resolve the conflicts then in eclipse. So for me this seems to be an egit issue.

Related Query

More Query from same tag