首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android 3.3中,“弹出菜单”、“git菜单”和“显示历史记录”之间的还原命令有什么不同?

在Android 3.3中,“弹出菜单”、“git菜单”和“显示历史记录”之间的还原命令有什么不同?
EN

Stack Overflow用户
提问于 2019-03-01 12:51:17
回答 2查看 176关注 0票数 0

我在AndroidStudio3.3中的项目中使用Github。

我发现恢复命令显示在三个位置,请参见图像1、图像2、图像3-1和图像3-2 (图像3-2是图像3-1的详细窗口,还原命令位于图像3-2的左中)。

这三个还原命令有什么不同?

图像1

图像2

图像3-1

图像3-2

EN

回答 2

Stack Overflow用户

发布于 2019-03-05 09:55:54

TLDR:

图1,Version Control -> Log -> Revert,编辑存储库,使其看起来像是提交之前的时间,并且还可以选择提交。

图2,VCS -> Git -> Revert...,删除所选文件的未提交更改。

图3,Local History -> Show History,作用类似于1,但在特定于JetBrains的工具中,与Git无关。

详细信息:

  1. Version Control -> Log -> Revert实际上是这样做的:
代码语言:javascript
复制
- (The `reset` at :29 is just want to restore the Git repository for testing.)
- First, it do a `git revert`, making some edit outside the control of Git, and the repository become dirty (needs to commit).
- Then, pop up a commit window, asking for you to commit.
- Second, after you decided what file to commit, make a `git add` and `git commit`.
- Conclusion: `Version Control` -> `Log` -> `Revert` = `git revert` (+ `git add` + `git commit`, optional ) = Edit the repository like before the commit it is reverted to.

  1. 只有当存储库脏时,VCS -> Git -> Revert... 才会激活。实际上是这样做的:
代码语言:javascript
复制
- First, it do a `git rm --cached -f`
- Then, it do a `git checkout HEAD`
- Conclusion: `VCS` -> `Git` -> `Revert...` = `git rm` + `git checkout` = Drop any uncommitted changes.

  1. Local History -> Show History 是由IntelliJ IDEA管理的独立内置VCS。 (以及其他JetBrains IDE,包括从IntelliJ IDEA社区获得补丁的Android ),它与Git或其他类型的VCS没有任何关系,如果您执行File -> Invalidate Caches / Restart -> Invalidate,它将被清除。该Revert的作用类似于Version Control -> Log -> Revert,两者都将源恢复到历史记录。
票数 2
EN

Stack Overflow用户

发布于 2019-03-03 14:38:39

VCS -> Git -> Revert...不会恢复提交,只会还原本地分阶段的更改。

它相当于git reset HEAD,也就是添加到索引中的非阶段更改

Log中显示的还原实际上将git revert一个提交,即:创建一个新提交,它将取消由还原提交引入的更改。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54945077

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档