Here is the difference between soft and hard option while using git-reset
soft : undo commit itself
hard : undo commit and modifications (changes)
For example, there are two commits after initial file adding.
git log after two commits
> git log
commit b2be5c58081be05d06ebfd7ee97851a4067eff11
Date: Mon Feb 4 13:51:24 2013 -0800
the second modification
commit 33e7c455c5fe698e02e56be26cc2a3b98deb4478
Date: Mon Feb 4 13:50:39 2013 -0800
the first modification
commit 01b0e72e64a00b9078035e09652f77b8239ec573
Date: Mon Feb 4 13:49:26 2013 -0800
add file01.txt
"git reset --soft HEAD^" will undo the last commit.
git reset --soft HEAD^
> git reset --soft HEAD^
> git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: file01.txt
#
Then commit it again and do "git reset --hard HEAD^" to remove the HEAD.
git reset --hard HEAD^
> git commit -a
[master 9134251] the second commit of the second modification
1 file changed, 2 insertions(+)
> git log
commit 913425118d774f1d05573eb4973893a8ebacb420
Date: Mon Feb 4 13:55:39 2013 -0800
the second commit of the second modification
commit 33e7c455c5fe698e02e56be26cc2a3b98deb4478
Date: Mon Feb 4 13:50:39 2013 -0800
the first modification
commit 01b0e72e64a00b9078035e09652f77b8239ec573
Date: Mon Feb 4 13:49:26 2013 -0800
add file01.txt
> git reset --hard HEAD^
HEAD is now at 33e7c45 the first modification
> git log
commit 33e7c455c5fe698e02e56be26cc2a3b98deb4478
Date: Mon Feb 4 13:50:39 2013 -0800
the first modification
commit 01b0e72e64a00b9078035e09652f77b8239ec573
Date: Mon Feb 4 13:49:26 2013 -0800
add file01.txt