I was experimenting with my app, made a few commits (about 5) and my app was working fine 5 commits before. I was editing multiple files during my experimenting. How can I revert my all changes I did and go back to the state of the code that was 5 commits before. For example, if I do hard reset to the commit I want to be at, it works fine, but if I push the changes, I need to merge or rebase which does a same thing for me as I don't know the difference between them. They merge the changes from the remote branch to my local branch and all the changes go back to the latest state of the remote branch. So, I want to make the commit with a message Reverting the state as 5 commits before that removes all the changes I did during 5 last commits and before that commit should be a commit with all the changes I did during 5 commits. How can I do it? I use Android Studio with Bitbucket.