Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed, DIRTY_WORKTREE in eclipse, how to solve it?

Tags:

git

eclipse

I am currently working on a java project and when committing my changes and pulling I get the following error. I don't know how to resolve it:

Dirty worktree, eclipse

I tried everything, but can't seem to fix the problem, can someone please help me?

To be clear, I am using eclipse.

like image 659
n00b1990 Avatar asked May 07 '14 08:05

n00b1990


People also ask

How do you fix a dirty working tree?

To resolve this issue you can do the following. Always commit your local changes in the file or stash them before you apply the pull/merge operation on the local branch. if you have forgotten step 1, and already facing DIRTY_WORKTREE then either you have to stash your uncommitted changes and then pull.

What is dirty work tree?

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.


4 Answers

Delete the affected files and try to pull again. Thereafter push your changes to the git.

like image 127
kds Avatar answered Oct 10 '22 15:10

kds


below steps may help

  1. delete non-versioned files git clean -df

  2. reset your local changes

    git fetch git reset --hard

like image 30
Mohannad Avatar answered Oct 10 '22 15:10

Mohannad


I got the same error while trying to merge the code. Delete the respective file in either of the branches to merge DIRTY_WORKTREE FAILED

like image 5
Vamsi Ravi Avatar answered Oct 10 '22 13:10

Vamsi Ravi


Assuming your working in a local branch, that is branched from a remote branch, and the merge conflict is occurring after you 'commit and push' upstream, merge to remote branch.

Try these 3 steps:

  1. Copy off the new changes from the specific file causing the merge issue.
  2. In Eclipse, Explorer pane, rt-click on the specific file causing the merge issue, and select replace with previous revision.
  3. Now perform a 'commit and push'
  4. Perform a merge to remote branch (no conflict should be observed).
  5. In Eclipse, rt-click on the specific file again, and select 'pull' - the file should now be in sync all the way through.
  6. Now add the new changes, save, commit and push, and merge to remote branch (not conflicts should be observed).
like image 1
kajonas Avatar answered Oct 10 '22 14:10

kajonas