// go back to the last 5 commit situation but all the latest code change still keeping here.
git rebase -i HEAD~5
// or you can rebase on old committed code
git rebase -i [committed_code]
// or you can rebase on root point
git rebase -i --root
// then the editor opened automatically, just update the list, change the second and following commits, replacing 'pick' with 's' then save it.
// the second & following commit will be combined into the first commit then.
// edit rebase config
git rebase --edit-todo
// push to git
git push --force
or
git push origin +[your branch]
or
git push origin/[your branch] --force