How to reset to my last commit in Android Studio

后端 未结 5 1928
北海茫月
北海茫月 2020-12-24 01:45

I commit changes to git from Android Studio, after that I have made some changes in my project that gives me errors, and now I want to get back that commited version that ha

5条回答
  •  滥情空心
    2020-12-24 02:03

    To undo your latest changes and reset to the most recent commit:

    Go to VCS -> Git -> Reset HEAD..

    Change Reset type to hard to remove those changes.

    It will look like this. You can validate the reset before you do it if you want.

    enter image description here


    What happens if you click Validate?
    A screen will pop up that shows the changes that were made in the commit you are about to reset to. You can view diffs per file that show what the commit changed in that file. It's more or less equal to what $ git show in a terminal would do.

    Contrary to what I assumed before, it does not show what files will be affected when you perform the reset.

提交回复
热议问题