eclipse 撤消 egit 中的单文件本地未提交更改(例如 svn revert)

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

Undo single-file local uncommitted change in egit (e.g. svn revert)

eclipseegit

提问by JesperE

Scenario: I have local uncommitted changes to a source file which I want to undo, and get the source file back in its pristine state. In command-line git I would do "git checkout ", but how do I do this in Egit?

场景:我对要撤消的源文件进行了本地未提交的更改,并使源文件恢复到原始状态。在命令行 git 中,我会执行“git checkout”,但我如何在 Egit 中执行此操作?

回答by Brad Cupit

See this answer: https://stackoverflow.com/a/4104149/152061(send upvotes there)

看到这个答案:https: //stackoverflow.com/a/4104149/152061(在那里发送赞成票

Right click on the file -> Replace With -> Index

(old versions might say File in Git Indexrather than Index)

(旧版本可能会说File in Git Index而不是Index

or if you want to undo all files that have changed, right click on the project -> Team -> Reset.. -> select the 'hard' radio button -> press the Reset button

或者,如果您想撤消所有已更改的文件,请右键单击项目 -> 团队 -> 重置.. -> 选择“硬”单选按钮 -> 按重置按钮

回答by Andrew

One work round is to select the file, right click > replace with > local history...

一种工作是选择文件,右键单击>替换为>本地历史记录...

select the last commit you did on that file. You can then check it looks ok then replace it in your workspace

选择您对该文件所做的最后一次提交。然后您可以检查它是否正常,然后在您的工作区中替换它

Then finally do a new commit that is effectively undoing the change you made, if you have to.

然后最后做一个新的提交,有效地撤消你所做的更改,如果你有必要的话。