如何重置为我在 Android Studio 中的最后一次提交 [英] How to reset to my last commit in Android Studio

查看:35
本文介绍了如何重置为我在 Android Studio 中的最后一次提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 Android Studio 提交了对 git 的更改,之后我在我的项目中做了一些给我错误的更改,现在我想取回没有错误的提交版本.我该怎么做?

I commit changes to git from Android Studio, after that I have made some changes in my project that gives me errors, and now I want to get back that commited version that has no errors. How can I do that?

推荐答案

要撤消最近的更改并重置为最近的提交:

To undo your latest changes and reset to the most recent commit:

转到 VCS -> Git -> 重置 HEAD..

重置类型更改为hard以删除这些更改.

Change Reset type to hard to remove those changes.

它看起来像这样.如果需要,您可以在重置之前验证重置.

It will look like this. You can validate the reset before you do it if you want.

如果您点击验证会发生什么?
将弹出一个屏幕,显示您将要重置的提交中所做的更改.您可以查看每个文件的差异,以显示该文件中提交更改的内容.它或多或少与终端中的 $ git show 相同.

与我之前的假设相反,它没有显示执行重置时哪些文件会受到影响.

Contrary to what I assumed before, it does not show what files will be affected when you perform the reset.

这篇关于如何重置为我在 Android Studio 中的最后一次提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆