Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I checkout an old git commit in Android Studio?

I would like to look at an old commit of my app in Android Studio in order to compile and run it. I don’t want to reset back to the previous commit or change my commit history or anything like that. When I’m done, I want to go back to the latest version.

On the command line, this would be a simple

git checkout <hash>

So how can I do this in Android Studio?

I haven’t tried to do it on the command line, because I’m afraid Android Studio might get heartburn when I modify its files externally. Reassurance that I can work with git outside of Android Studio without problem would be fine too.

like image 438
user1785730 Avatar asked Apr 09 '16 13:04

user1785730


People also ask

How do I checkout an older commit?

To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.

How do you checkout one commit back?

Use git checkout & the ID (in the same way you would checkout a branch) to go back: $ git checkout <commit-id> .

How do I revert a commit in Github Android?

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. Save this answer.


1 Answers

If you want to checkout commit using Android Studio (or other IntelliJ IDEA based IDE) just go toVersion Control view (alt+9) and click the Log tab. Type your commit hash in Filter input, right-click on the commit entry and click the Checkout Revision option.

What's more, if you want to work with a command line, simply use git from command line. I'm working with Git using only command line and nothing wrong happend yet. The only thing that you have to remember is to wait for reindexing end.

like image 170
Kamil Avatar answered Sep 30 '22 07:09

Kamil