git 如何使用EGit从头替换最新版本的eclipse项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9356680/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:31:14  来源:igfitidea点击:

How to replace an eclipse project with latest version from head using EGit?

eclipsegitegitjgit

提问by ams

I have an eclipse workspace with a bunch of projects from git, I am using egit to manage the project. I typically try out experiments which fail, and I want to take a project and restore it to exactly its state in HEAD of the git repo.

我有一个 eclipse 工作区,里面有一堆来自 git 的项目,我正在使用 egit 来管理项目。我通常会尝试失败的实验,并且我想进行一个项目并将其恢复到 git 存储库 HEAD 中的准确状态。

How do I do that with EGit?

我如何用 EGit 做到这一点?

I have tried to right click on the project Replace With > Head Revision which causes eclipse to crash. I am new to git migrated from svn. is there an equivalent of svn revert for a project?

我试图右键单击项目 Replace With > Head Revision 这会导致 eclipse 崩溃。我是从 svn 迁移过来的 git 的新手。是否有相当于项目的 svn revert?

采纳答案by VonC

If you don't have any non-versioned files (ie "private" files) that you don't want to lose, then you can try and reset your working tree to your current HEAD.

如果您没有任何不想丢失的非版本化文件(即“私有”文件),那么您可以尝试将您的工作树重置为您当前的 HEAD。

See "Resetting your current HEAD ", choosing the "hard" option.

请参阅“重置您当前的 HEAD”,选择“硬”选项。