如何在Android Studio中将项目还原为先前的提交 [英] How to revert project back to a previous commit in android studio

查看:568
本文介绍了如何在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键(在Mac上为Command + 9键)打开版本控制面板.切换到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天全站免登陆