I would recommend learning to use the interactive rebase, but in case it seems too complicated to you, you can simply use
git reset --soft <diverging-commit>
to undo all commits up to the diverging point without changing the index, and
git commit -s
to make a single commit of all the changes.