git 失败,eclipse中出现DIRTY_WORKTREE,怎么解决?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23512578/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed, DIRTY_WORKTREE in eclipse, how to solve it?
提问by n00b1990
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:
我目前正在处理一个 Java 项目,在提交更改和拉取时出现以下错误。我不知道如何解决它:
I tried everything, but can't seem to fix the problem, can someone please help me?
我尝试了所有方法,但似乎无法解决问题,有人可以帮助我吗?
To be clear, I am using eclipse.
需要明确的是,我正在使用 eclipse。
回答by kds
Delete the affected files and try to pull again. Thereafter push your changes to the git.
删除受影响的文件并再次尝试拉取。此后将您的更改推送到 git。
回答by Mohannad
below steps may help
以下步骤可能会有所帮助
delete non-versioned files
git clean -df
reset your local changes
git fetch git reset --hard
删除非版本化文件
git clean -df
重置您的本地更改
git fetch git reset --hard
回答by Vamsi Ravi
I got the same error while trying to merge the code. Delete the respective file in either of the branches to merge
我在尝试合并代码时遇到了同样的错误。删除任一分支中的相应文件以进行合并
回答by kajonas
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:
试试这3个步骤:
- Copy off the new changes from the specific file causing the merge issue.
- In Eclipse, Explorer pane, rt-click on the specific file causing the merge issue, and select replace with previous revision.
- Now perform a 'commit and push'
- Perform a merge to remote branch (no conflict should be observed).
- In Eclipse, rt-click on the specific file again, and select 'pull' - the file should now be in sync all the way through.
- Now add the new changes, save, commit and push, and merge to remote branch (not conflicts should be observed).
- 从导致合并问题的特定文件中复制新更改。
- 在 Eclipse 的资源管理器窗格中,按住 rt 键单击导致合并问题的特定文件,然后选择替换为以前的修订版。
- 现在执行“提交并推送”
- 执行合并到远程分支(不应观察到冲突)。
- 在 Eclipse 中,再次 rt-单击特定文件,然后选择“拉” - 该文件现在应该一直保持同步。
- 现在添加新的更改,保存、提交和推送,并合并到远程分支(不应观察到冲突)。
回答by UsamaAmjad
In my case, I had uncommittedchanges.
就我而言,我有未提交的更改。
I committed my changes and then I was able to mergesuccessfully without dirty_worktree
error.
我提交了我的更改,然后我能够成功合并而不会dirty_worktree
出错。
回答by RBrown
So... another option that worked for me and my DIRTY_WORKTREE... Stashyour changes and then Pull.
所以......那工作了我和我的DIRTY_WORKTREE ...另一种选择 藏匿的更改,然后拉。
This solution meant that I did NOT lose some local useful logging changes from simply deleting the offending file.
这个解决方案意味着我不会因为简单地删除有问题的文件而丢失一些本地有用的日志更改。
回答by Ajinkya Karode
I had the same error as:
我有同样的错误:
DIRTY_WORKTREE pom.xml
DIRTY_WORKTREE pom.xml
So I deleted the pom.xmlfrom my working directory and did a pull from particular branch.
所以我从我的工作目录中删除了pom.xml并从特定分支进行了拉取。
It worked for me.
它对我有用。
回答by Shahan Mehbub
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
我通过为无法删除的文件选择“假设未更改”解决了此错误。
STS,在工具栏中。显示视图-> Git 暂存-> 未暂存的更改。
或
右键单击文件-> 团队-> 高级-> 假设未更改