How to delete commit and get back changes in Android Studio

Viewed 97

I did a commit in Android Studio but I want to make more changes but I dont want to do another commit.

I can see my commit here enter image description here

What I want to do, is to get back my changes here and delete this commit without pushing it to Github

enter image description here

Can someone help me with this issue?

1 Answers

get the desired commit hash by using on the BRANCH_NAME which contains the commit you want :

git log 

copy the hash and use this command

git checkout COMMIT_HASH

then will generate a temp branch, to save it you can use

git switch -c NEW_BRANCH_NAME

to rollback your old branch to this commit run the following two commands

git checkout BRANCH_NAME
git merge NEW_BRANCH_NAME
Related