Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse/Git - Pull Failed Dirty Worktree

Tags:

git

eclipse

ide

As the title states, I'm attempting to pull from a git repository that I'm sharing between my friend and I and I can commit, he can commit, but whenever either one of us attempt to pull it brings back that it failed: DIRTY_WORKTREE

Both of us are extremely new to git, and have zero direction on how to fix this issue.

like image 307
Ariana Avatar asked May 12 '14 01:05

Ariana


6 Answers

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.

like image 155
Clerenz Avatar answered Oct 24 '22 01:10

Clerenz


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.

like image 44
VonC Avatar answered Oct 24 '22 00:10

VonC


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

like image 44
ununiform Avatar answered Oct 24 '22 00:10

ununiform


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.

like image 36
abagri Avatar answered Oct 24 '22 00:10

abagri


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.

like image 34
noname Avatar answered Oct 23 '22 23:10

noname


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.

like image 28
mahesh reddy Avatar answered Oct 23 '22 23:10

mahesh reddy