Reputation: 96
I am working on an Android application for a school project and need assistance.
I am new to collaborative development and version control with Github and I need to know how to revert to a previous commit using Android Studio's implementation of Git version control.
I was just about to commit a large chunk of new code and before doing so, I decided to update my project with the latest version on Github. Unfortunately, I blindly used the merge settings the IDE provided and now my project is pretty messed up.
I was hoping that someone may be able to instruct me on how to revert to a previous commit in Github.
Upvotes: 1
Views: 2869
Reputation: 731
Thanks to @player87
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.
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 <[email protected]>
Date: Fri Jun 11 22:37:35 2015 -0400
Some helpful commit message should be here.
If that is the commit you want to revert to, then execute git checkout 7c247b
.
Upvotes: 1
Reputation: 916
1.Remove all un-commited changes.
2.Apply the changes from the stash by selecting from the stash list.
Git->UnstashChanges -> (select the first one) ->ApplyStash
3.Commit your changes
4.Then use the VCS arrow to pull and merge the changes from the remote repository
Upvotes: 0