git reset HEAD~1

Ralf Corsepius ralf.corsepius at rtems.org
Mon Feb 13 14:13:59 UTC 2012


Hi,

http://wiki.rtems.org/wiki/index.php/Git

tells:

  git reset HEAD-1

Removes the last 1 (or any other number you put) commit from the current 
branch. git reset should only be used on local branches that no one else 
is accessing remotely. This is a very powerful and tricky command; A 
good description of what it enables to do can be found here


Either there is a language barrier causing me to misunderstand this 
sentence or this sentence doesn't seem right:

git reset HEAD  ... removes the last commit
git reset HEAD~1 ... remove the last 2 commits

The human factor had just hit me (I needed to revert my last commit), 
causing me to exercise this to trip over this.

Ralf





More information about the devel mailing list