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.

- 936
- 1
- 9
- 26
-
2Have you tried clicking right click on the commit name in the version control tab/Log? There should be _Reset Branch to here_ – rahimli Jul 02 '16 at 18:55
-
2I had not. Prior to this post I didn't know the version control tab log existed. – aisflat439 Jul 02 '16 at 19:03
-
Read all about it here: http://stackoverflow.com/questions/34519665/how-to-move-head-back-to-a-previous-location-detached-head/34519716#34519716 – CodeWizard Jul 02 '16 at 19:17
9 Answers
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 <john@doe.ca>
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
.

- 1,781
- 1
- 14
- 21
-
2I apologize for not making the question more clear. I would like to do this through android studio and not the command line. Thanks for your answer. – aisflat439 Jul 02 '16 at 18:55
-
1
-
-
-
Open the Version Control Panel using alt + 9
and click on Log. This should show a list of commits. Right click on the commit you want to revert to and select Reset Current Branch to Here
. This should bring up a list of options to keep or discard changes when reverting. Select Hard
to discard any current changes and click Reset.

- 980
- 8
- 12
- In android studio 4.0, go to version control -> Log.
- Then select the commit you want to revert to.
- Choose Reset current branch to here.
- You ll see a popup, select Hard and its done.

- 468
- 5
- 8
Android Studio -> Version Control -> Select your commit -> Right panel -> Select you want to be reverted file.
Then you can get the new reverted change, commit -> done.

- 1,430
- 1
- 11
- 5
Android Studio > check bottom toolbar -> click on git -> select log tab -> right on particular commit -> reset current branch to here -> select hard reset
Also if u have already pushed code to server u need to run
git push -f origin branch_name

- 2,028
- 1
- 18
- 30
MacOS users
Rollback Changes
⌘ Command + ⌥ Option + Z
VCS -> Git -> Rollback...
//or
VCS Local Changes Toolbar -> Rollback...
//or
Commit Changes -> Rollback...

- 29,217
- 8
- 193
- 205
While push is selected branch to undo; example brach name -> push_will_be_undone
git push -f origin push_will_be_undone
Writing did my job and it worked for me

- 274
- 1
- 9
Right click on folder where you Github folder, press Git Bash Here
and type git reset --hard

- 296
- 1
- 11
-
"Reset" is not a "revert". Even if your local files seem to be reset to the previous commit. Other users who have pulled your "reset" commit will see it in their history – Farid Mar 17 '21 at 05:32