n00b1990
n00b1990

Reputation: 1249

Failed, DIRTY_WORKTREE in eclipse, how to solve it?

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.

Upvotes: 37

Views: 88875

Answers (9)

Shubh
Shubh

Reputation: 1

The most simple and easy way is to Rebase

  1. Right click Repo > Rebase See image
  2. Stash your changes
  3. Done, WOW
  4. From the stashed changes just compare and take necessary code or you can apply stash

Upvotes: -1

Mohannad
Mohannad

Reputation: 111

below steps may help

  1. delete non-versioned files git clean -df

  2. reset your local changes

    git fetch git reset --hard

Upvotes: 10

Shahan Mehbub
Shahan Mehbub

Reputation: 77

I resolved this error by selecting "Assume Unchanged" for the file that I was unable to delete.
STS, In the toolbar. Show View->Git Staging->Unstaged Changes.
OR
Right-click on the file->Team->Advanced->Assume Unchanged

Git Staging View

Upvotes: 0

Ajinkya Karode
Ajinkya Karode

Reputation: 172

I had the same error as:

DIRTY_WORKTREE pom.xml

So I deleted the pom.xml from my working directory and did a pull from particular branch.

It worked for me.

Upvotes: 0

RBrown
RBrown

Reputation: 313

So... another option that worked for me and my DIRTY_WORKTREE... Stash your changes and then Pull.

This solution meant that I did NOT lose some local useful logging changes from simply deleting the offending file.

Upvotes: 0

UsamaAmjad
UsamaAmjad

Reputation: 4604

In my case, I had uncommitted changes.

I committed my changes and then I was able to merge successfully without dirty_worktree error.

Upvotes: 0

kajonas
kajonas

Reputation: 11

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).

Upvotes: 1

Vamsi Ravi
Vamsi Ravi

Reputation: 1236

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

Upvotes: 6

kds
kds

Reputation: 28665

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

Upvotes: 60

Related Questions