Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reset to any of the previous commit in android studio?

I made some commits to git from android studio. Now I want to reset to one of the committed version. How can I do that within android studio?

like image 270
Tony Baby Avatar asked May 07 '16 15:05

Tony Baby


2 Answers

At last I have found the solution.

  1. Go to VCS -> Git -> Show History
  2. From Log, right click on the required committed version and select Reset Current Branch to Here.enter image description here
  3. Select Hard and click on Reset button.
like image 135
Tony Baby Avatar answered Sep 28 '22 08:09

Tony Baby


open terminal in android studio :

You can do this by following two commands:

git reset --hard [previous Commit SHA id here]
git push origin [branch Name] -f

It will remove your previous git commit.

If you want to keep your changes you can also use:

git reset --soft [previous Commit SHA id here] 

Then it will save your changes.

For more details How do you undo the last commit?

like image 25
USKMobility Avatar answered Sep 28 '22 10:09

USKMobility