Looking at that history, it seems that you commited that commit, cherry-picked it on another branch, and then tried to revert it on both branches again.
To clean that up I would first suggest you to make sure that all those commits (especially including those uncommitted changes at the top) don’t contain any information you don’t want to lose.
Afterwards, you can use the following command to throw everything else away and just get back to that one commit. Note that this really cuts of the tree, hence make sure that you don’t have any data you want to keep.
git reset --hard 8791cc9176
This will reset your current branch to that commit, ignoring everything else. So you probably want to reset your local master there. Afterwards, you can delete your Safe
branch using git branch -D Safe
(note the upper-case D
to be able to delete branches that are not merged into other branches—for all other cases, use a lower case d
to make sure you don’t lose information).
Since your remote is also on a more advanced state, you probably want to get rid of those extra commits there too. Note that by default you cannot just push an older history and replace this on the remote. Instead you have to force-push it using git push --force origin master
(or -f
in short). While it is okay to use it for your personal project, you should know that you should never do this when working with others or when your repository is publicly available. This will change the history on the remote to a state that cannot be automatically handled with by other users accessing the remote. So they will likely run into conflicts. That’s why you should (a) always make sure that what you are pushing is really good-to-push, and (b) always undo things on the remote by adding commits (e.g. reverting commits as you have already used here).