ChiefAmay
ChiefAmay

Reputation: 130

How to discard local changes in Android Studio GUI?

I want to discard the local changes I made in an Android Studio project.

I tried to perform a pull, the GUI gives me 5 options, which option should I choose?

Upvotes: 3

Views: 9958

Answers (3)

Monika Moon
Monika Moon

Reputation: 198

In Android Studio do the following:

-Open the Version Control tool window Alt+9 and switch to the Log tab.

-Select the recent commit and right click on it than select Reset Current Branch to Here.

-A Git Reset popup will open -> select Hard -> click Reset

Upvotes: 6

Michael
Michael

Reputation: 584

In Android studio do the following:

Go to VCS -> Git -> Reset HEAD

Change Reset type to hard

Upvotes: 2

torek
torek

Reputation: 489293

You originally asked which strategy argument to use with git pull to discard your own work (there is a pending edit that will change the question, if the edit is approved). The answer is: None.

Don't use git pull at all. Run git fetch first:

git fetch origin

This brings over all the new stuff from the other Git you have your Git calling "origin".

Now that you have everything they have, simply stop using what you have been using, and switch to theirs:

git reset --hard origin/master   # assuming you're on your "master"

You may also want to use git clean -fdx to remove build artifacts, but that's a separate issue.

Upvotes: 2

Related Questions