I have a case whereby I regret to commit a code on top of a commit. Since I have not yet push the change, I want to change my commit based on another parent commit. This what I did to make it happen:

$ git rebase --onto [new parent hash] [old parent hash]

After I executed this command, there are some conflicted files. I resolved the conflicts, and continue the rebase using this command:

$ git rebase --continue

By now, new commit created on that parent commit with my changes applied. Thanks to git rebase.