eclipse git插件还原文件


文章目录



eclipse git插件还原本地修改的文件

1、 以TestTwo.java为例,打开TestTwo.java文件,如图:eclipse git插件还原文件_git

2、右击文件,选择Team -> Show Local History ,如图:

eclipse git插件还原文件_eclipse_02

eclipse git插件还原文件_git_03

3、右侧的历史列表中,有不同的历史版本,选择compare current with local,如图:

eclipse git插件还原文件_git插件本地文件_04

eclipse git插件还原文件_git插件还原文件_05

如果是你想要还原的地方,那么继续第4步;

4、点击右键菜单中Get Contents开始还原文件,如图:

eclipse git插件还原文件_git插件还原文件_06

eclipse git插件还原文件_eclipse_07

还原之后,如下图:

eclipse git插件还原文件_git插件本地文件_08

eclipse git插件还原提交但未push的文件

1、在TestTwo.java中创建devBranch()方法并且commit(提交);如下图:

eclipse git插件还原文件_git插件本地文件_09

2、还原操作步骤;如图:

eclipse git插件还原文件_git插件还原文件_10

eclipse git插件还原文件_git插件还原文件_11

3、点完Yes之后,如下图:

eclipse git插件还原文件_eclipse_12

右击文件选择Override;

eclipse git插件还原文件_git插件还原文件_13

点击Yes;

eclipse git插件还原文件_git_14

在看着代码编辑区,dev创建的devBranch方法已经不在了;但是,我又发现一个问题,见下图:

eclipse git插件还原文件_git插件本地文件_15


疑问:还原之后,项目那里还是显示有一个待push;而TestTwo文件名前的’>'还在,我也是挺纳闷的,在网上也搜到了类似的情况;不知道咋回事,有人说是git插件的问题,建议用git 命令来进行还原;


发现

当我准备关机睡觉了,把刚刚关闭的eclipse又重新打开了,然后惊艳到我了;看截图:

eclipse git插件还原文件_git_16

看,上面的疑问,现在已经不存在了;对于上面的疑问,我觉得是git插件对于状态获取的不及时导致的