コミットした後で「やっぱりこのcommitはなかったことにしたい」というときは、
$ git reset --hard HEAD^
を使います。
今、Gitのログが
$ git --no-pager log
commit ee8831f07fcd5007816ef6e75682b826659a79cd
Author: tomohiro <tomohiro@example.com>
Date: Fri Jan 1 20:51:25 2016 +0900
add URL
add the URL of the Ragtimeblues
commit ab374c5f64e3de33b079b9e013ac2cec7830935d
Author: tomohiro <tomohiro@example.com>
Date: Fri Jan 1 16:57:09 2016 +0900
first commit
となっているとき、一つ前に戻してみます。
$ git reset --hard HEAD^ HEAD is now at ab374c5 first commit
これで、OKです。再度ログを確認してみると
$ git --no-pager log
commit ab374c5f64e3de33b079b9e013ac2cec7830935d
Author: tomohiro <tomohiro@example.com>
Date: Fri Jan 1 16:57:09 2016 +0900
first commit
となっており、sample.txtの内容も
$ cat sample.txt Ragtimeblues
と、最初のコミット内容に戻っています。