如何将项目恢复到 android studio 中的先前提交 [英] How to revert project back to a previous commit in android studio

查看:36
本文介绍了如何将项目恢复到 android studio 中的先前提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 android studio 中处理一个项目,并想恢复到以前的推送.我尝试了
VCS => Git => 重置头(硬)
但是我在 Android Studio 中的项目没有改变,可能是因为我做错了什么.我想将 Android Studio 中的项目恢复到我已经推送并在 github 上看到的特定早期提交.我不关心自上次推送以来我所做的任何更改.
此外,如果可能,我希望通过 Android Studio 中的 GUI 完成此操作.

I am working on a project in android studio and would like to revert to a previous push. I attempted
VCS => Git => Reset Head (Hard)
but my project in Android Studio is unchanged, likely because I'm doing something wrong. I would like to revert the project in Android Studio to a specific earlier commit that I've pushed and I see on github. I do not care about any changes that I have made since the earlier push.
Additionally, I would like this to be done through the GUI within Android Studio if possible.

推荐答案

Android Studio 使用说明:如果您想在 Android Studio 中执行此操作,请按 alt + 9 (或 Command + 9(在 Mac 上)打开版本控制面板.切换到 Log 选项卡并右键单击上一个提交.选择 Checkout Revision.

Android Studio Instructions: if you want to do this in Android Studio, press alt + 9 (or Command + 9 on Mac) to open the Version Control panel. Switch to the Log tab and right click on a previous commit. Select Checkout Revision.

命令行说明:打开您正在使用的命令行工具.转到 Android 应用程序的 Git 目录(使用 cd).执行 git log 并找到您要还原的上一个提交.

Command line instructions: Open the command line tool you are using. Go to the Android app's Git directory (using cd). Execute git log and find the previous commit you want to revert to.

commit 7c247be6d8975dc88f6cc2631c154786a1f3b79e
Author: John Doe <john@doe.ca>
Date:   Fri Jun 11 22:37:35 2015 -0400

    Some helpful commit message should be here.

如果这是您要还原的提交,则执行 git checkout 7c247b.

If that is the commit you want to revert to, then execute git checkout 7c247b.

这篇关于如何将项目恢复到 android studio 中的先前提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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