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.
To checkout a previous commit, you will use the Git checkout command followed by the commit hash you retrieved from your Git log.
Use git checkout & the ID (in the same way you would checkout a branch) to go back: $ git checkout <commit-id> .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With