さて、
$ git reset --hard HEAD^
では、ワーキングツリー、インデックス共に一つ前のコミットに戻りましたが、
commitだけを戻す場合は
$ git reset --soft HEAD^
を使います。
$ git status
On branch master
nothing to commit, working directory clean
$ 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 --soft HEAD^
を実行してみると、
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: sample.txt
tomohiro@imola:~/sandbox.test$ git --no-pager log
commit ab374c5f64e3de33b079b9e013ac2cec7830935d
Author: tomohiro <tomohiro@example.com>
Date: Fri Jan 1 16:57:09 2016 +0900
first commit
となり、コミットのみが一つ前に戻せます。