I do a commit to my local repo, then I pushed it to origin after that I amended the commit and tried to push it but I got an error saying that I need to pull from origin, I made that and a conflict happened I fixed it and committed the change to local and remote repos. Now my commit history is horrible here it is:

The commit I made named: An early version of the ImportImageModel
How I can rebase the history to fix these unnecessarily commits?
Interactive rebase should do the trick. It allows do to many things, among them removing commits.