I made changes to my code in android studio and now just want to discard all changes and pull fresh code from git.
I tried Git -> Fetch, but it is not deleting the code I wrote and just adds git code. I also tried Git -> Update Project -> Rebase the current branch on top of incoming changes, but it also does not help.
CodePudding user response:
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.
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.