Here is what I have done so far. And what I'm trying to do is merge the first and second commits into a single commit before I push (have not added remote repository yet).
$ git init
$ vim myprogram
$ git add myprogram && git commit -m "Initial commit"
$ vim README.md
$ git add README.md && git commit -m "Added readme"
$git log --pretty=oneline
b8e2979 Added readme
a579d65 Initial commit
$ git rebase -i HEAD~2
fatal: Needed a single revision
invalid upstream HEAD~2
You want to use the
... Rebase all commits reachable from
<branch>, instead of limiting them with an
<upstream>. This allows you to rebase the root commit(s) on a branch. ...
git rebase -i --root